18

I'm trying to use Eclipse to edit sources, compiled under C++ Builder, but stuck with Unresolved inclusion problem.

For example, code like:

#include <vector>

Gives Unresolved inclusion: <vector> error in Eclipse IDE. C++ Builder indeed has no vector file, instead it has vector.h which is used by compiler.

Eclipse IDE gives no error if I write

#include <vector.h>

How do I tell Eclipse to use vector.h when it sees #include <vector>?

rmflow
  • 4,445
  • 4
  • 27
  • 41
  • Which release of C++ Builder do you have, model 1997 or 2010 or inbetween? – Bo Persson May 12 '11 at 13:44
  • 1
    According to this page [wikipedia.org/wiki/C++Builder#Version_history](http://en.wikipedia.org/wiki/C++Builder#Version_history) version 4 was released in 1999! That might be a big part of your problem. You can easily get free, and very much newer, versions of g++ or Microsoft Visual C++ Express. – Bo Persson May 13 '11 at 07:03
  • Does this answer your question? ["string could not resolved" error in Eclipse for C++ (Eclipse can't resolve standard library)](https://stackoverflow.com/questions/7905025/string-could-not-resolved-error-in-eclipse-for-c-eclipse-cant-resolve-stan) – Ciro Santilli OurBigBook.com Apr 23 '20 at 18:21

4 Answers4

27

This allowed me to avoid Eclipse "Unresolved inclusion" error.

In my case I had to find the location of the C++ vector header on my computer (which is a Mac):

find /usr/local -name vector -print

I found the correct include location in folder "/usr/include/c++/4.2.1". Then I set my project eclipse settings like so:

Project->Properties->C/C++ General->Paths and Symbols->GNU C++->(Add)->"/usr/include/c++/4.2.1"

I'm not using C++ Builder, but my solution might address part of your trouble.

Christopher Bruns
  • 9,160
  • 7
  • 46
  • 61
6

You could also try use "CDT GCC Built-in Compiler Settings". Go to the project properties > C/C++ General > Preprocessor Include Path > Providers tab then check "CDT GCC Built-in Compiler Settings" if it is not.

None of the other solutions (play with include path, etc) worked for me for the type 'string', but this one fixed it.

Virtual
  • 449
  • 6
  • 15
4

On Windows, with Eclipse CDT Oxygen, none of the solutions described here worked for me (including the "Provider" - "CDT GCC Built-in Compiler Settings"). What works for me is:

  • Install Cygwin, with notably the following packages (maybe not all are strictly needed for this):
    • libgcc1
    • cygwin32-gcc-core, cygwin32-gcc-g++
    • gcc-g++
    • mingw64-x86_64-gcc-core, mingw64-x86_64-gcc-g++
  • In Project Properties:
    • Go to "C/C++ Build" - "Tool Chain Editor" and select "Cygwin GCC" as the "Current toolchain": Project Properties - Tool Chain Editor
    • Go to "C/C++ General" - "Preprocessor Include Paths, Macors etc.", in the "Providers" tab, select:
      • "CDT Users Setting Entries" (I need them for other includes, such as the Google Test ones, which I manually referenced);
      • "CDT GCC Built-in Compiler Settings Cygwin". Project Properties -Providers
Xavier Lamorlette
  • 1,152
  • 1
  • 12
  • 20
2

memory and memory.h don't refer to the same source.

One is for c, the other for c++

Do you have the right includes source in your project settings ?

djfoxmccloud
  • 571
  • 1
  • 9
  • 23
  • OK, there is conditional `#if !defined(__USING_STD_NAMES__)` which is obviously true when included as and false if included as . How do I tell all this stuff to Eclipse? – rmflow May 12 '11 at 12:09
  • To better understand your need let me ask : why do you need to tell that to eclipse ? If you really need memory.h then use the #include but if you want to use the c++ header then make sure that the path to the C++ bluider includes file are set in the Properties(of your project)>C/c++ general > path and symbols>include > your compiler Then you can add the correct ressources – djfoxmccloud May 12 '11 at 12:26
  • changed `memory` to `vector` to show my point. There is no vector.h in gnu c++, but C++Builder has this file and uses it when it sees `#include ` – rmflow May 12 '11 at 12:52
  • hm... if you go F3 on #include the file is itself including #include ? At least that is what is done with my gcc headers. If your C++ builder includes are in the include path of your project then it should resolve the name and find it. – djfoxmccloud May 12 '11 at 13:14