Author Topic: Including from a parent directory problem...  (Read 4645 times)

Offline asmodehn

  • Single posting newcomer
  • *
  • Posts: 5
    • Asmodehn's Home Site
Including from a parent directory problem...
« on: October 05, 2005, 12:47:14 am »
Hello,

I really enjoy using C::B for a while and I just fall on one problem today.

I have a folder hierarchy structure like that :

stuff/project1 / mystuff1.cbp / include
                                         / src
      /project2 / mystuff2.cbp / include
                                         / src
      /Common / include
                    / src

before I had mystuff1 project working fine using includes and src as relative paths.

Then I tried to include a file from ../Common/include and it seems that have messed up the relative paths checking in my project.
The different build options doesnt ask me to store paths as relative, and store them as absolute instead.
and the build fails because of :

Compiling: src\MyStuff1.cc
mingw32-gcc.exe: 1: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)

although all the path in my .cbp xml are fine : include/xxxxxx.hh and ../Common/include/xxxxxxx.hh as I expected.

so I am just wondering where gcc is run from in that case... how can I find more about that problem, and how I can work around.

Thanks for any help you can provide :-)

sethjackson

  • Guest
Re: Including from a parent directory problem...
« Reply #1 on: October 05, 2005, 01:30:27 am »
is MyStuf1.cc in /include/src or is there another folder in /project1 called /src?
Also if you are trying to compile source as C code give the file a .c extension, if you are trying to compile as C++ give it a .cpp extension.

Offline asmodehn

  • Single posting newcomer
  • *
  • Posts: 5
    • Asmodehn's Home Site
Re: Including from a parent directory problem...
« Reply #2 on: October 05, 2005, 03:41:40 am »
I review that and I think havent been accurate enough, so let be a bit more :-)

stuff / project1 / mystuff1.cbp
                      / include
                      / src / Mystuff1.cc

       / project2 / [...]

       / Common / include / MyInclude.hh

building mystuff1.cbp using relative path for src/Mystuff1.cc works fine.

but as soon as I try to include ../Common/include/Myinclude.hh my tree view in the Manager on the left just changed from
/ sources / src /MyStuff1.cc

to

/sources / project1 / src/ Mystuff1.cc
/headers / common / include/ MyInclude.hh

but still the path in the .cbp still remain "src/ Mystuff1.cc" and "../Common/include/MyInclude.hh"

and the build failed with gcc not able to find src/MyStuff1.cc.
So...


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Including from a parent directory problem...
« Reply #3 on: October 05, 2005, 08:57:11 am »
The fodler hierarchy you see in the project manager, starts from the common top-level path of all the project files. So, when you added something from ../Common, it is now part of the equation and the common top-level path would be 'stuff'. In other words, this is the designed behaviour.

About the compiler error you 're getting, it has nothing to do with the project's layout on disk. At least it shouldn't.
Please enable full build logging (Settings->Compiler->Other) and post the build log here to see what's wrong.
Be patient!
This bug will be fixed soon...

Offline asmodehn

  • Single posting newcomer
  • *
  • Posts: 5
    • Asmodehn's Home Site
Re: Including from a parent directory problem...
« Reply #4 on: October 05, 2005, 11:07:15 am »
Thank you very much I didnt find where to setup the full log first... I will keep this setting, I like to know what I am doing ;-)

So I found what the problem was... my own stupid memory forgot how to put definitions on gcc command line. So in the build option in compiler -> definition, I put MYDEF 42 instead of MYDEF=42... and that just throw weird errors.

I was a bit confused about the tree heirarchy but now that you explained it, he makes perfectly sense.

Thanks a lot for that !