|
|
|
|
|
|
|
|
|
|
Re: Eclipse shows unresolved inclusion but it compiles [message #759943 is a reply to message #738539] |
Wed, 30 November 2011 11:08   |
Eclipse User |
|
|
|
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 09:33   |
Eclipse User |
|
|
|
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?
|
|
|
|
|
|
|
|
|
|
|
|
Re: Eclipse shows unresolved inclusion but it compiles [message #932466 is a reply to message #931327] |
Thu, 04 October 2012 01:59  |
Eclipse User |
|
|
|
Figured out Eclipse Juno include issue:Default Eclipse JUNO C++ project GCC (Executable - whats so different about Auto tools?; Linux tool chain - whats wrong with GCC or Cross tool chain?) includes are as follows:
Includes
/usr/include
/usr/include/x86_64-linux-gnu
/usr/lib/gcc/x86_64-linux-gnu
/usr/lib/gcc/x86_64-linux-gnu/4.6/include
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
/usr/local/include
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
cout << "Hello World" << endl; // prints Hello World
return 0;
}
Eclipse complains missing, after rebuilding using Indexer: 1. Unresolved inclusion: 2. Unresolved inclusion: 3. Symbol 'std' could not be resolved 4. Symbol 'cout' could not be resolved
After 3 days, wasting time trying all combinations: I see iostream in ./usr/include/c++/4.6/iostream so ADDed /usr/include/c++/4.6 to includes clears 1. and 2. Re indexing shows lot of missing inclusions: Unresolved inclusion: bits/c++config.h unresolved inclusion: stdio.h ... and others $ sudo find . -name stdio.h ./usr/lib/syslinux/com32/include/stdio.h ./usr/include/c++/4.6/tr1/stdio.h ./usr/include/stdio.h ./usr/include/x86_64-linux-gnu/bits/stdio.h SO WHICH ONE SHOULD I INCLUDE and I see /usr/include/stdio.h already included?
I then tried combinations until I found also ADDing these two removed the errors, anyways its a shame these are not documented anywhere /usr/include/c++/4.6/backward /usr/include/c++/4.6/x86_64-linux-gnu
|
|
|
Powered by
FUDForum. Page generated in 0.09441 seconds