News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Moving to GCC question

Started by troels, January 18, 2006, 01:08:16 PM

Previous topic - Next topic

troels

Quote from: mandrav on January 20, 2006, 09:52:12 AM
* 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

Ceniza

Quote from: troelsAfter 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

troels

#47
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).

yop

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

So now I understand, it's about

cd WhereTheFileIs/file.cpp
gcc file.cpp

instead of
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.

troels

Quote from: Takeshi Miya on September 24, 2006, 08:40:33 PM
So now I understand, it's about
cd WhereTheFileIs/file.cpp
gcc file.cpp

instead of
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:
gcc -IWhereTheFileIs file.cpp

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


troels

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

MortenMacFly

Quote from: troels on December 02, 2015, 01:55:56 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]