Author Topic: Moving to GCC question  (Read 39287 times)

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Moving to GCC question
« Reply #45 on: September 23, 2006, 10:26:18 pm »
* Added compiler-independent option to explicitely add the currently compiling file's directory to the compiler's search dirs
Autotools do change the working dir to the file's dir also, like MSVC

After a good long time to think I cannot think of any reason not to do it like autotools and MSVC.

In other words, how about removing this option? Just make the default to change the dir to the compiling file's dir when compiling. This seems natural and would bring CB in step with the other tools.

Regards

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Moving to GCC question
« Reply #46 on: September 24, 2006, 07:07:40 am »
Quote from: troels
After a good long time to think I cannot think of any reason not to do it like autotools and MSVC.

In other words, how about removing this option? Just make the default to change the dir to the compiling file's dir when compiling. This seems natural and would bring CB in step with the other tools.

The main reason it isn't implemented by default is because having an IDE that does that kind of tricks at your back is evil. Generalizing: any software that does that kind of things is evil.

As usual some people like it, some others not, that's why it's an option... and since it's really evil, it's disabled by default :D

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Moving to GCC question
« Reply #47 on: September 24, 2006, 09:16:36 am »
Just for the record:
This is not a about adding a dir to the include list (evil).
Think setcwd. This is about launching the compiler, gcc.exe or whichever, in the dir of the module to be compiled, instead of launching it in some mother dir (the .cbp dir).
« Last Edit: September 24, 2006, 09:27:21 am by troels »

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Moving to GCC question
« Reply #48 on: September 24, 2006, 11:31:34 am »
This would also save a few more annoying things like when building from Makefiles the compiler reports the errors/warnings from the build/sources dir and then when c::b handles them it searches for the file in the wrong path (clicking on the error does not open the respective file). This is kind of the standard way that any Makefile generator (qmake/bakefile/autotools) handles builds. I don't really know what advantages the current approach has so I might be missing something.
Life would be so much easier if we could just look at the source code.

takeshimiya

  • Guest
Re: Moving to GCC question
« Reply #49 on: September 24, 2006, 08:40:33 pm »
So now I understand, it's about

Code
cd WhereTheFileIs/file.cpp
gcc file.cpp
instead of
Code
gcc -IWhereTheFileIs file.cpp
right?

This makes sense, and it's valid not only for gcc or any other compiler, but for any language, build tool or interpreter.

troals: I'd say leave the option but change the default.

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Moving to GCC question
« Reply #50 on: September 24, 2006, 09:10:49 pm »
So now I understand, it's about
Code
cd WhereTheFileIs/file.cpp
gcc file.cpp
instead of
Code
gcc -IWhereTheFileIs file.cpp
right?

Yes! You are illustrating the issue much better than I.

To recapitulate:
This is what the option currently do albeit not by default:
Code
gcc -IWhereTheFileIs file.cpp

But this would be a nicer default behaviour as it is what other tools seems to be doing:
Code
cd WhereTheFileIs
gcc file.cpp

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Moving to GCC question
« Reply #51 on: December 02, 2015, 01:55:56 pm »
Maybe this option can be removed again
"Explicitly add currently compiling file's directory to compiler search dirs" (Build Options tab)
It seems that 'recent' versions of MinGW gcc itself adds the compiling file's directory now (since when?).
Ie, I can compile my projects now without this option set, and also the test in Reply#3 that used to fail in 2006 (www.trak.dk/gcctest.zip)

Using CodeBlocks 15.12 RC with bundled MinGW tdm-1.
Best regards

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Moving to GCC question
« Reply #52 on: December 03, 2015, 01:02:44 pm »
Maybe this option can be removed again
As long as old compilers are in th use we shouldn't remove it. Its disabled by default and... well... "well hidden" so it should not harm. And anyways: If you enable it it won't cause any negative side-effects even if MinGW add it once again.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ