Bug #19290 2014-02-14 04:02

nduplessis

"-I" Flag for GNU G++ Compiler Causing Issues

Release: 13.12, Revision: 9501

Whenever I create a C++ project with the header file and source file of a class in the same folder as the project file and try to compile them together using the GNU G++ compiler CB puts the "-I" flag into the compile line with no include directory following it. This causes a compile error with G++ when trying to create the object file for the class (Undefined reference to 'WinMain@16').

To find out was causing it I copy/pasted the compile line from the build log into the command line and used trial and error with the compile flags.

To Recreate:

1.) Start Code Blocks

2.) Go to File->New->Project->Console Application (using default settings)

3.) Try to build it, should work fine (no "-I" flag in compile line)

4.) Go to File->New->Class

5.) Put a check next to "Header and implementation file shall be in the same folder" and create the class

6.) Try to build and you should get the WinMain@16 error ("-I" in compile line).

Category
Compiler
Group
Platform:Windows
Status
Open
Close date
 
Assigned to
 
nduplessis 2014-02-14 04:17

Note:

If you create a class foo with foo.h and foo.cpp in the same directory and try to create an object file foo.o with this:

"g++ -I -c -o foo.o foo.cpp" - won't compile.

"g++ -c -o foo.o foo.cpp" - compiles.

If foo.h is in a subdirectory called include:

"g++ -Iinclude -c -o foo.o foo.cpp" - compiles

nduplessis 2014-02-14 16:59

Update:

Upon further investigation, there was some new file pathing options added to the new class dialog in one of the latest revisions. The problem is fixed when the "add paths to project" box is left unchecked.

So whenever the user checks the box "header and implementation file shall be in the same folder" the "add paths to project" checkbox should automatically get unchecked and grey out.

nduplessis 2014-02-15 15:41

This was fixed in the latest nightly build. Apologize for any inconvenience.