1

I have some c++ code using CImg and Eigen libraries. At the c++ code I define a plugin like this

#define cimg_plugin1 "my_plugin.h"
#include "CImg.h"

The plugin contains many method definitions that are used at the c++ code.

I also have a makefile that when called from the command line (./make), allows me to compile everything, and generates an executable.

I want to import this code into a new Eclipse project, and I do it so:

  • New>Project>C++ project>makefile project>empty project
  • unmark "Use default location", and select the folder containing my code at the filesystem
  • Project>properties>C/C++ Build>unmark "Use default build command" and set it to use my makefile
  • Also in project properties>C/C++ General>Paths and Symbols>Add paths to folders containing Eigen and CImg
  • Rebuild index
  • Clean project
  • Restart eclipse

When I build the project, eclipse tells me I have more than 1000 errors in "my_plugin.h", but it is capable to generate the executable. Even though, I would like to get rid of this errors, because they are annoying. Also, if I want to open the declaration of CImg methods used at the plugin, I can't.

I know it has been asked before, but any of the solutions I found were satisfactory for me (most of them enumerated at the previous list). The sources I visited are the following, and I would be really happy if you find and tell me others I didn't see.

Eclipse shows errors but project compile fine eclipse C project shows errors (Symbol could not be resolved) but it compiles Eclipse CDT shows some errors, but the project is successfully built http://www.eclipse.org/forums/index.php/t/247954/

Community
  • 1
  • 1
Anthony
  • 443
  • 1
  • 5
  • 16
  • Why don't you chose "Project with existing code" option in eclipse? It picks up make files and other project settings all from the directory. It is difficult assess what the IDE didn't pick from the configs that is used when building with command line. – fkl Nov 13 '13 at 09:56
  • Can you include an example of some of the errors eclipse is giving? – benjymous Nov 13 '13 at 10:07
  • @benjymous most of the errors are "Field/function ... could not be resolved", regarding CImg/Eigen functions that could be clearly resolved, as the program works when I execute it. – Anthony Nov 13 '13 at 10:18
  • Does this answer help? http://stackoverflow.com/questions/10803685/eclipse-cdt-symbol-cout-could-not-be-resolved edit: or this one: http://stackoverflow.com/questions/10041453/eclipse-c-type-could-not-be-resolved-error-even-though-build-is-successful – benjymous Nov 13 '13 at 10:22
  • already seen it, but "search For Unresolved Includes" doesn't return any one for me – Anthony Nov 13 '13 at 10:24
  • neither the other solutions worked – Anthony Nov 13 '13 at 10:25
  • @fayyazkl how do I choose "Project with existing code"? I thought that's what I was doing... – Anthony Nov 13 '13 at 10:29
  • File->New->MakeFile project with existing code – fkl Nov 13 '13 at 10:36
  • thanks @fayyazkl, but this way I find exacly the same problem(s) – Anthony Nov 13 '13 at 10:55
  • Have you made sure that before actual compilation, previous errors are cleared up? i.e. they are being generated as a result of current attempt? – fkl Nov 13 '13 at 11:51
  • yes, I am quite sure about that – Anthony Nov 13 '13 at 12:53

0 Answers0