Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » GCC doesn't find include path
GCC doesn't find include path [message #715105] Fri, 12 August 2011 11:27 Go to next message
Marco  is currently offline Marco Friend
Messages: 4
Registered: August 2011
Junior Member
Hi,

I have a small Eclipse C++ project and want to compile it in my VM with Suse 11.1.
It's a new Suse installation and I downloaded the latest Eclipse CDT version and the svn plugin.
Now my problem:

There is a directory "include" in my project folder which contains 2 header files. I added the directory in the C++ options("${workspace_loc:/libbz2/include}")

The compiler can't find the header files.

make all
Building file: ../blocksort.c
Invoking: GCC C Compiler
gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"blocksort.d" -MT"blocksort.d" -o "blocksort.o" "../blocksort.c"
In file included from ../blocksort.c:22:
../bzlib_private.h:33:19: error: bzlib.h: Datei oder Verzeichnis nicht gefunden
In file included from ../blocksort.c:22:


The odd thing: It compiles on another system! So I don't think it's an Eclipse project settings problem. But I habe no idea whats the trouble.
The only clue I have: the compiler seems to search in the parent directory as youo can see on the error message: ../bzlib_private.h:33:19:

So any hints what is going wrong?


Best regards

Marco
Re: GCC doesn't find include path [message #716080 is a reply to message #715105] Tue, 16 August 2011 12:22 Go to previous messageGo to next message
HagenFriend
Messages: 90
Registered: April 2010
Member
On 8/12/2011 1:27 PM, Marco wrote:
> I added the directory in the C++ options
> ("${workspace_loc:/libbz2/include}")

wrong syntax, correct is:

${workspace_loc}/libbz2/include
Re: GCC doesn't find include path [message #716102 is a reply to message #716080] Tue, 16 August 2011 13:10 Go to previous messageGo to next message
Marco  is currently offline Marco Friend
Messages: 4
Registered: August 2011
Junior Member
Hello,

the syntax ${workspace_loc:/libbz2/include} was auto generated and works well. The project also compiles with another system as it is.

I tested your syntax before and the compiler doesn't find the header file anyway.


Best regards
Re: GCC doesn't find include path [message #716134 is a reply to message #716102] Tue, 16 August 2011 13:42 Go to previous messageGo to next message
HagenFriend
Messages: 90
Registered: April 2010
Member
Marco wrote:

> error: bzlib.h: [file or directory not found]

Looks like the bzip2 development package - which contains the include
file bzlib.h - is not installed.

On Ubuntu, the name is "libbz2-dev". SuSE might use different names.
Re: GCC doesn't find include path [message #716336 is a reply to message #716134] Wed, 17 August 2011 05:36 Go to previous messageGo to next message
Marco  is currently offline Marco Friend
Messages: 4
Registered: August 2011
Junior Member
It is installed. As I wrote, exactly this project (checked out from svn server) compiles very well on another system. This is not the problem.

But why does the compiler search teh file in the parent folder? As you can see in my first posting, the error messages says "can't find ../bzlib_private.h". The inlcude line is "#include "bzlib_private.h"". Where comes the "../" from?

[Updated on: Wed, 17 August 2011 05:37]

Report message to a moderator

Re: GCC doesn't find include path [message #716347 is a reply to message #715105] Wed, 17 August 2011 06:22 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
I added the directory in the C++ options("${workspace_loc:/libbz2/include}")

Where did you add the include folder exactly? The gcc command does not show any include path (should be something like "-IMyIncludePath").
The correct place to add the include path is:
Project Properties->C/C++ Build->Settings
There is a tab "Tool Settings". Here you should your include path (GCC C Compiler in your case).


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: GCC doesn't find include path [message #716351 is a reply to message #716336] Wed, 17 August 2011 06:49 Go to previous messageGo to next message
HagenFriend
Messages: 90
Registered: April 2010
Member
On 8/17/2011 7:36 AM, Marco wrote:
> But why does the compiler search teh file in the parent folder? As
> you can see in my first posting, the error messages says "can't find
> ../bzlib_private.h". The inlcude line is "#include
> "bzlib_private.h"". Where comes the "../" from?

From the path to your source file. The command line is

> gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"blocksort.d"
> -MT"blocksort.d" -o "blocksort.o" "../blocksort.c"

The path of your source file is given as "../blocksort.c".
And '#include "filename.ext"' searches in the directory where the source
file is (the form '#include <filename.ext>" searches in the given
include paths).

[This is gcc pre-processor 101. Sorry for the off-topic post.]
Re: GCC doesn't find include path [message #716385 is a reply to message #716351] Wed, 17 August 2011 09:10 Go to previous messageGo to next message
Marco  is currently offline Marco Friend
Messages: 4
Registered: August 2011
Junior Member
OK, but why does it compile on another system? It's the same project structure, the same project settings. Both systems use the newest Eclipse CDT version, both are fresh installed.
Re: GCC doesn't find include path [message #716406 is a reply to message #716385] Wed, 17 August 2011 10:03 Go to previous message
HagenFriend
Messages: 90
Registered: April 2010
Member
On 8/17/2011 11:10 AM, Marco wrote:
> OK, but why does it compile on another system? It's the same project
> structure, the same project settings. Both systems use the newest
> Eclipse CDT version, both are fresh installed.

The error message tells you the reason.

It has NOTHING to do with Eclipse.

Read carefully:

> Invoking: GCC C Compiler
> gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"blocksort.d" -MT"blocksort.d" -o "blocksort.o" "../blocksort.c"
> In file included from ../blocksort.c:22:
> ./bzlib_private.h:33:19: error: bzlib.h: Datei oder Verzeichnis nicht gefunden
> In file included from ../blocksort.c:22:


blocksort.c
includes
bzlib_private.h

bzlib_private.h
includes
bzlib.h

bzlib.h: not found


bzlib.h is a system include file (these live e.g. in /usr/include/).

It comes with the bzip2 library development package "libbz2-dev"
(or however the package is called on SuSE11.1).

On the system where the compile fails, the development package that
contains bzlib.h is not installed.

On the system where it works, you will have it installed.

Clear now?
Previous Topic:GUI with Qt
Next Topic:How to switch toolchains
Goto Forum:
  


Current Time: Fri Apr 26 15:30:03 GMT 2024

Powered by FUDForum. Page generated in 0.03834 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top