|
Re: Eclipse shows unresolved inclusion but it compiles [message #738675 is a reply to message #738539] |
Sun, 16 October 2011 15:38 |
Eclipse User |
|
|
|
"MrT" wrote in message news:j7edms$1ai$1@news.eclipse.org...
> I've installed the Eclipse Indigo version on ubuntu. It compiles, and can
> be run
> but eclipse show errors, like unresolved inclusion in all the invocations
> to functions
> of the standard library like cout, string, etc.
Try right-clicking on your project and selecting Index->Rebuild from the
menu.
--
Regards,
Jarrick
|
|
|
|
|
|
|
|
|
|
|
Re: Eclipse shows unresolved inclusion but it compiles [message #759943 is a reply to message #738539] |
Wed, 30 November 2011 16:08 |
Andrea Messages: 27 Registered: July 2009 |
Junior Member |
|
|
Okay, I was having the same problem, and something weird happened. What
I did was the following:
- I manually created a file using g++ as specified in the Discovery
Options dialog, that is, I called "g++ -E -P -v -dD
${plugin_state_location}/specs.cpp >& ~/buildResult" (obviously with the
right value for ${plugin_state_location})
- I then specified the buildResult file as input for "Load build output
from file" in the Discovery Options dialog
- rebuilt the index
It works. So far so good. Now, the weird thing is that putting back
everything as it was doesn't break it. It still works. And it also seems
to take the include from my makefile, and put it in as a built in value,
which is neither intended nor desired.
Anyway, it seems to work. I thought it might be interesting to know
On 10/16/2011 01:16 PM, MrT wrote:
> I've installed the Eclipse Indigo version on ubuntu. It compiles, and
> can be run but eclipse show errors, like unresolved inclusion in all the
> invocations to functions of the standard library like cout, string, etc.
|
|
|
|
|
|
Re: Eclipse shows unresolved inclusion but it compiles [message #762709 is a reply to message #762696] |
Thu, 08 December 2011 14:33 |
Daniel U. Thibault Messages: 6 Registered: July 2009 |
Junior Member |
|
|
I'm having a similar problem with include files and an apparent disconnect between Eclipse's build process and its error reporting. I'll give detailed steps to reproducing this problem, so we can narrow the causes down as quickly as possible. One thing is for sure: this is not a locale problem.
Eclipse 3.7.1 (Indigo SR1) for C/C++ Linux Developers, Ubuntu 10.10 64-bits
It all started when I imported an existing project that "makes" just fine on its own: I thought Eclipse would help considerably in navigating the files and figuring out what does what. However, some of the #included system headers seemed not to be having the correct effect in Eclipse's view. This was very puzzling, and in the course of investigating this, I managed to recreate the problem in a tiny sand box.
Step one: Create a new C project (File: New: C Project) using the Hello World ANSI C Project sample. The parameters are Executable: Hello World ANSI C Project/Linux GCC, the remaining Empty projects set to Linux GCC, and GNU Autotools set to Hello World ANSI C Autotools Project. Call it "hello". Be sure to generate the makefile automatically (Advanced Settings, I believe it is the default).
Step two: Adjust the include path. Using Project: Properties: C/C++ General: Paths and Symbols: Includes: GNU C, set the search path to /usr/local/include, /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include, /usr/include. The second path depends on the exact version of gcc you have installed. This doesn't matter too much, as long as the build path includes at least /usr/include.
Now if you open hello.c, it looks very simple, and Eclipse is quite happy except for return EXIT_SUCCESS;, which cannot resolve EXIT_SUCCESS. Replace EXIT_SUCCESS with a zero (0) and Eclipse gives the all-clear. Select ]Project: Build Project to generate the executable.
Open a command-line window and drill down to your Eclipse workspace folder's hello/Debug subfolder. Once there, you can run the executable with the line ./hello.
Now the fun begins. Modify hello.c to read in its latter part:
#include <fcntl.h>
int main(void) {
printf("Hello World!\n");
int zz = SPLICE_F_MOVE;
printf("zz (SPLICE_F_MOVE) is '%d'\n", zz);
printf("Bye World!\n");
return 0;
}
You'll get an error on the int zz... line: "Symbol 'SPLICE_F_MOVE' could not be resolved". If you Build the project, you'll get a similar error in the console view: "error: 'SPLICE_F_MOVE' undeclared".
Now if you change the preamble to:
#define __USE_GNU
#include <fcntl.h>
You still get the error on the int zz line (in the editor), but the project will Build correctly! You can confirm this by running the binary in the command-line window you opened earlier. This is really odd since examination of /usr/include/fcntl.h will show that it #includes <bits/fcntl.h>, and that latter header #defines SPLICE_F_MOVE (and a bunch of others) in a block guarded by #ifdef __USE_GNU. Why on Earth isn't our #define __USE_GNU properly propagated in the workspace perspective?
So this is my problem in a nutshell: why is it the editor (and all of Eclipse CDT) reports an error (apparently by refusing to process correctly an include), but that the underlying build succeeds?
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07998 seconds