0

I have set include directories and library files in Eclipse c++, still I get below error. In my program I have the include directive

#include <xercesc/parsers/XercesDOMParser.hpp>

Error shown - 'fatal error: xercesc/parsers/XercesDOMParser.hpp: No such file or directory' Attached images of how I set include paths and libraries. Am I doing it correctly? Or Am I missing something?

include path image

library image

library paths image

Jonah Graham
  • 7,890
  • 23
  • 55
  • JonahGraham has correctly and painstakingly answered your question. It would be polite to [accept](http://stackoverflow.com/help/accepted-answer) his answer. – Mike Kinghan Nov 06 '15 at 22:23
  • @Mike - Yesterday, I was about to logout when I saw Jonah's answer and thought clarifying the doubt(since this was related to same) about the include path(whether relative/absolute) and tried the same today. Hence delay in accepting the answer. I totally agree and appreciate Jonah's efforts. Thanks. –  Nov 07 '15 at 14:44

1 Answers1

1

You have modified the indexer settings, rather than the build settings. Try changing the settings in C/C++ Build -> Settings instead.

Indexer Settings (in C/C++ General)

These control how CDT highlights code and code completion and various other features of CDT work. The indexer settings inherit the build settings. If you note in your first screenshot there is a "CDT Managed Build Setting Entries" just below where you have added your paths, that is where the setting from the build are populated.

You would normally only need to modify these settings if you have some configuration on your system that CDT cannot automatically detect.

Build Settings (in C/C++ Build)

These control the arguments that are passed to the compiler. In addition, these settings are inherited by the indexer (see above) to handle indexer features.

So for example, if you set build settings for an extra include path like this:

build settings

It is automatically set for you in the indexer settings, see:

inherited

and here:

inherited2

Jonah Graham
  • 7,890
  • 23
  • 55
  • That means I have to move the directory paths to 'CDT Managed Build Setting Entries'? and one more question- Do relative paths work for include files or I have to specify the absolute path till the .hpp file? As you can see I have added both(1. xerces-c-3.1.1-x86_64-linux-gcc-3.4\include and 2. xerces-c-3.1.1-x86_64-linux-gcc-3.4\include\xerces\parsers) - but I don't know which of them is correct(if I would have added them under 'CDT Managed Build Setting Entries'). –  Nov 06 '15 at 15:21
  • 1
    "That means I have to move the directory paths to 'CDT Managed Build Setting Entries'?" Yes. – Jonah Graham Nov 06 '15 at 18:14
  • As for what the correct things to add to your set of includes for a particular library, that is a question of its own, so you would be best to post it as one. I don't know the answer, so with a new question you will increase visibility. – Jonah Graham Nov 06 '15 at 18:16
  • I changed the settings in C/C++ Build->Settings under Cygwin C++ compiler and entered relative path xerces-c-3.1.1-x86_64-linux-gcc-3.4\include as shown in your 1st screen-shot. This solved the problem. Thanks for your correct answer. –  Nov 07 '15 at 14:36
  • @Jonah-The compilation errors have gone but I am getting another error - 1. "relocation truncated to fit: R_X86_64_PC32 against undefined symbol `xercesc_3_1::AbstractDOMParser::adoptDocument()'" 2. "undefined reference to `xercesc_3_1::AbstractDOMParser::adoptDocument()'". Posted as separate question - http://stackoverflow.com/questions/33719825/how-to-resolve-relocation-truncated-to-fit-r-x86-64-pc32-against-undefined-sym Can u help me to resolve these too? Thanking you in advance. –  Nov 16 '15 at 06:17