Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Unresolved inclusion: <stddef.h>(should i add a path? which path?)
Unresolved inclusion: <stddef.h> [message #1710014] Fri, 02 October 2015 16:17 Go to next message
sneakyimp Mising name is currently offline sneakyimp Mising nameFriend
Messages: 41
Registered: December 2009
Member
I'm aware that includes in brackets <> refer to standard libraries and, although these should be "normally" available, they are not in Eclipse for some reason despite the fact that my installation is as vanilla as one can get. I installed it without making any changes. I created a new project based on existing source (the php 5.x source). For some reason the project (or my core IDE settings) seem to lack the necessary paths/symbols/whatever for the code parser to recognize everything. size_t, for instance, is not recognized.

I understand that I may add a path to the project but am entirely unsure what path to add. When I compile, it would appear that CC is used, and yet when I search for stddef.h on my machine, I see no path that would apparently correspond to a standard headers directory for cc. There is gcc, but no cc. There are dozens of options:
$ sudo find / -name "stddef.h"
[sudo] password for sneakyimp: 
/usr/include/linux/stddef.h
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/stddef.h
/usr/lib/syslinux/com32/include/bitsize/stddef.h
/usr/lib/syslinux/com32/include/stddef.h
/usr/src/linux-headers-3.8.0-32/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-32/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-29-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-33-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-34-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-39/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-39/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-36/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-36/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-34/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-34/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-36-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-42-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-44/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-44/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-37-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-42/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-42/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-29/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-39-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-33/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-33/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-38-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-38/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-38/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-44-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-37/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-37/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-35/include/uapi/linux/stddef.h
/usr/src/linux-headers-3.8.0-35/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-35-generic/include/linux/stddef.h
/usr/src/linux-headers-3.8.0-32-generic/include/linux/stddef.h
Re: Unresolved inclusion: <stddef.h> [message #1710837 is a reply to message #1710014] Fri, 09 October 2015 15:38 Go to previous messageGo to next message
sneakyimp Mising name is currently offline sneakyimp Mising nameFriend
Messages: 41
Registered: December 2009
Member
Hello? Does *anyone* have any suggestions on how to fix this? I tried adding a path (/usr/include/linux/stddef.h) but the code parser still flagged all kinds of errors that shouldn't be there. The 'unresolved inclusion' error remains.
Re: Unresolved inclusion: <stddef.h> [message #1710905 is a reply to message #1710837] Sat, 10 October 2015 17:31 Go to previous messageGo to next message
sneakyimp Mising name is currently offline sneakyimp Mising nameFriend
Messages: 41
Registered: December 2009
Member
Whoa! Slow down! Lets not have everybody at once trying to trip over each other to answer my questions.
Re: Unresolved inclusion: <stddef.h> [message #1710916 is a reply to message #1710905] Sat, 10 October 2015 20:59 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
First, you should be aware that you are dealing with two things: the IDE and a compiler. If you aren't already aware, Eclipse expects to build using make which is responsible for compilation and linking. Eclipse can generate the make file but you could instead do it yourself. Unresolved include comes from the code analysis parser which itself is only used to attempt to catch errors before an actual build. It's not really needed and other than seeing annoying messages, its output is harmless. The message is caused by Eclipse not knowing where your headers are located. This is specified on the C/C++ Project properties=>C/C++ General==>Preprocessor Include Paths, Macros, etc Entries tab. It expects directory paths and not file names. You implied you used the tab otherwise it's not at all clear what you meant by "adding a path (/usr/include/linux/stddef.h)". In fact, it's not at all clear what you have done. Whatever it means, at the very least, remove the "stddef.h" part.

See http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_general_sd_entries.htm for more information on the tab. Note the image there shows a "CDT GCC Built-in Compiler Settings ..." entry. If you don't have this entry (and it sounds like you don't) then you need to select it on the Providers tab in the same dialog. More info in this at http://help.eclipse.org/luna/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_sd_providers.htm?cp=10_4_7_0_4_6_1 You will need to rebuild the index after modifying these settings.

Second, in your original post, you come across as someone who needs much more than a single, simple answer. For example, CC is a common make macro used so the compiler specification occurs in only one place. I doubt you saw CC by itself and more likely it was as $(CC) or ${CC}. My suggestion is to create an "Hello, World" project then modify it to contain your current code. Doing so will set up your project with defaults commonly needed to find things in /usr/include and other places. Alternately, since you have pre-existing code, you could select New==>Makefile Project using Existing Code instead. If you already have a make file disable generating one by deselecting Generate Makefiles automatically in C/C++ Project properties=>C/C++ Build ==> Builder Settings tab.

[Updated on: Sat, 10 October 2015 22:34]

Report message to a moderator

Re: Unresolved inclusion: <stddef.h> [message #1711307 is a reply to message #1710916] Wed, 14 October 2015 19:41 Go to previous message
sneakyimp Mising name is currently offline sneakyimp Mising nameFriend
Messages: 41
Registered: December 2009
Member
David:

Thank you so much for your detailed and thoughtful response. I guess it's clear that my understanding of C coding and compilers is pretty limited. I hope to learn fast.

I've been busy but I hope to apply your instructions hopefully in the next day.
Previous Topic:: can't open Eclipse CDT and get error of "JVM terminated. Exit code=13"
Next Topic:Problems with Eclipse 4.4/4.5 and C/C++ Qt Support Plugin
Goto Forum:
  


Current Time: Thu Sep 26 08:11:52 GMT 2024

Powered by FUDForum. Page generated in 0.03948 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top