User forums > General (but related to Code::Blocks)

Moving to GCC question

(1/11) > >>

troels:
Hi all,
I'm moving a MSVC6 project (an entire workspace really) to C::B. Import went well.

1. GCC and relative #include paths:

This compiles: #include "../include/someheader.h"
This doesn't compile: #include "../../include/someotherheader.h" ("No such file or directory")

Apparantly (this version of) GCC cannot handle two updirs ("../..").
Any way around this limitation?

Regards
Troels

Using 1.0rc2 with MinGW compiler, updated with Nightly Build Jan. 16
Running on Win2000 SP4, WinXP SP2

mandrav:
GCC has no problems with two updirs (or three or four or whatever).
Just realize that it needs to find the included file...

thomas:
More likely, your include paths are set up incorrectly. gcc (or MinGW for that matter) normally handles many levels of ../../../ without any problems.

Check that whatever it is you try to include really exists where the compiler would expect it (i.e. from one of the paths supplied as include paths).

troels:

--- Quote from: thomas on January 18, 2006, 01:17:16 pm ---Check that whatever it is you try to include really exists...

--- End quote ---

It certainly does. It compiles in MSVC.


--- Quote from: mandrav on January 18, 2006, 01:15:38 pm ---GCC has no problems with two updirs (or three or four or whatever).

--- End quote ---

Good to hear, quite a relief.

This might be a C::B issue then:

- If I right click the offending .c file and choose "Build file" in the menu it compiles!
- If I press Ctrl+F9 it doesn't compile ("No such file or directory")

Here's a little test C::B project for demonstrating this:
http://www.trak.dk/gcctest.zip
Also included in the zip is the corresponding MSVC project.
It compiles in MSVC, not in C::B (using Ctrl+F9)

Thanks
Troels

Michael:
After adding the include directories, I had to modify the #include (mylib\src\mylib.c) in:


--- Code: ---#include "mylib.h"

--- End code ---

Then it compiled.


--- Quote ----------------- Build: Win32 Debug in gcctest ---------------
Compiling: .\mylib\src\mylib.c
Linking console executable: C:\test\gcctest\Debug\gcctest.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

--- End quote ---

Michael

Navigation

[0] Message Index

[#] Next page

Go to full version