Reputation: 9597
I have mixed C++ / Java project in Eclipse. I've setup a build.mk file and Eclipse builds project successfully when all files in editor are closed. When I open a .h or a .cpp file Eclipse finds a lot of undefined symbols in them. I have references to 3rd party API and all the problems seem to be related to symbols from that API. Strangely, some types are considered defined in Eclipse, and some are considered undefined even though in some cases they are defined in the same .h file.
My colleague is not experiencing any of these problems, but we are clueless where to start solving this problem. We already made sure that our Eclipse include directories are the same. Is there some way to compare eclipse project settings?
Update: .cproject files and .project files and files in .settings directory know differ only by some paths. Did not help to solve my problem though.
Upvotes: 31
Views: 76943
Reputation: 1
I finally figured this out. Flushing the Eclipse Indexer as mentioned in the top voted answer didn't work for me. This is what I had to do:
I went to: Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes
Here I had the path for my include directory, but what I had to do was delete the directory path, and then re-add it making sure to check the box "Add to all configurations". I also checked the box "Add to all languages", but I don't think that is necessary.
After this, you may need to then click on Project -> C/C++ Index -> Rebuild. I didn't need to, but you might. Also, obviously instead of C/C++ in the paths above, it will be Java or whatever language you are dealing with.
Upvotes: 0
Reputation: 567
I had the same problem. It take place when in included file I'd used
namespace std
without using it in main file or vice versa. Do check using namespace equally.
Upvotes: 1
Reputation: 1676
You can compile and run the source code also by Right Click On Project>Run C/C++ Code Analysis. This will solve your problem.
Upvotes: -1
Reputation: 13690
I had the same problem. It could be resolved by flushing the Eclipse indexer.
I used the projects context menu and selected Index->Rebuild
and Index->Freshen All Files
. The last removed the error messages.
Upvotes: 78
Reputation: 9597
Turns out I needed to change Code Analysis settings that are on Launching tab, and I simply did not see that tab.
Upvotes: 4