Author Topic: Problems with g++ options  (Read 4589 times)

Offline Sagrer

  • Multiple posting newcomer
  • *
  • Posts: 12
Problems with g++ options
« on: October 13, 2006, 12:24:50 am »
I tried to build in linux one application, which i made first only in windows..... it is in wxWidgets.... in windows - i added all flags, directories (includes etc...) directly into target options.... but in linux - it is a wx-config script, so - i created a default wxWidgets application by CodeBlocks wizard (in Ubuntu linux), looked project and targets options and tryed to make same target for my application - i deleted all flags (except -Winvalid-pch -include wx_pch.h), directories, defines (except USE_PCH)... added calling wx-config.... but if i try to build this - it calls g++ so:

Code
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH  -I./build/linux/objs -I- -I./build/linux/objs -I. -I/usr/include  -c MhbFile.cpp -o ./build/linux/objs/MhbFile.o
cc1plus: note: obsolete option -I- used, please use -iquote instead
In file included from <command line>:1:
./wx_pch.h:9:23: error: wx/wxprec.h: No such file or directory

So - g++ options are : `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH  -I./build/linux/objs -I- -I./build/linux/objs -I. -I/usr/include

i can't understand - where from are this "-I-", "-I.", "-I./build/linux/objs" (twice! :shock:)

if i delete this strange things and call (from console) this:
Code
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -I/usr/include  -c MhbFile.cpp -o ./build/linux/objs/MhbFile.o
- it works fine....

For default wxWidgets application - it is no such problems...

Attached my *.cbp file.

I use Ubuntu 6.06 and CodeBlocks nightly from 9 October 2006.

This *.cbp file was first created by CodeBlocks 1.0 RC2, then i used nightly builds - may be something corrupted in *.cbp?

[attachment deleted by admin]

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: Problems with g++ options
« Reply #1 on: October 13, 2006, 06:41:02 am »
from http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gcc/directory-options.html:

Quote
-I-

    Any directories you specify with -I options before the -I- option are searched only for the case of #include "file"; they are not searched for #include <file>.

    If additional directories are specified with -I options after the -I-, these directories are searched for all #include directives. (Ordinarily all -I directories are used this way.)

    In addition, the -I- option inhibits the use of the current directory (where the current input file came from) as the first search directory for #include "file". There is no way to override this effect of -I-. With -I. you can specify searching the directory which was current when the compiler was invoked. That is not exactly the same as what the preprocessor does by default, but it is often satisfactory.

    -I- does not inhibit the use of the standard system directories for header files. Thus, -I- and -nostdinc are independent.

so maybe it has something to do with telling C::B to not include the build directory in search paths.
3 years until google knows more than god.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Problems with g++ options
« Reply #2 on: October 13, 2006, 08:32:17 am »
It's a known bug. Please change the PCH mode in project options and all will work fine.
Be patient!
This bug will be fixed soon...