User forums > Using Code::Blocks

Enjoying C++11 Experience with Code::Blocks

<< < (3/3)

eranif:

--- Quote ---Why? -std=c++0x works perfectly well.
--- End quote ---
On my machine, using GCC-4.6.1-TDM / wxWidgets 29.4 you get errors if you try to use something like:


--- Code: ---auto s = wxString("Hello world");
--- End code ---

The only thing that fixes this is changing the flag:

--- Code: ----std=c++0x
--- End code ---
to

--- Code: ----std=gnu++0x
--- End code ---

If I change to a different compiler (GCC4.7.1 from MinGW) - then it is working
Note that this is true for Windows only with this specific compiler

Here is the compiler output (g++ is 4.6.1 from TDM):


--- Code: ---g++ -c "c:/cp/CdeLiteHello/HelloWorld/gui.cpp" -std=c++0x -g -Wall -O0 -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.9.4\lib\gcc_dll\mswud -IC:\wxWidgets-2.9.4\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -D__WX__ -o ./Debug/gui.o -I.
In file included from C:\wxWidgets-2.9.4\include/wx/string.h:50:0,
from C:\wxWidgets-2.9.4\include/wx/intl.h:17,
from c:/cp/CdeLiteHello/HelloWorld/gui.h:11,
from c:/cp/CdeLiteHello/HelloWorld/gui.cpp:8:
C:\wxWidgets-2.9.4\include/wx/wxcrtbase.h: In function 'char* wxStrdup(const char*)':
C:\wxWidgets-2.9.4\include/wx/wxcrtbase.h:697:62: error: '_strdup' was not declared in this scope
In file included from C:\wxWidgets-2.9.4\include/wx/intl.h:17:0,
from c:/cp/CdeLiteHello/HelloWorld/gui.h:11,
from c:/cp/CdeLiteHello/HelloWorld/gui.cpp:8:
C:\wxWidgets-2.9.4\include/wx/string.h: In function 'int Stricmp(const char*, const char*)':
C:\wxWidgets-2.9.4\include/wx/string.h:174:31: error: 'strcasecmp' was not declared in this scope
mingw32-make.exe[1]: *** [Debug/gui.o] Error 1
--- End code ---

Eran

cpp_lover:
Hi Neil,

Am I doing something wrong here since I have the linker error? I have the following files selected on the Toolchain executables tab:

Compiler installation directory: C:\tdmgcc
C compiler: mingw32-gcc-4.6.1.exe
C++ compiler: mingw32-g++.exe
Linker for dynamic libs: ld.exe
Linker for static libs: ar.exe
Debugger: gdb.exe
Resource compiler: windres.exe
Make program: mingw32-make.exe

Kindly have a look at the attached picture and reply. Thanks.

cpp_lover:
I found the mistake finally. :-)

Incorrect setting is
Linker for dynamic libs: ld.exe

Correct setting is
Linker for dynamic libs: mingw32-g++.exe

On that tab, all other settings remain the same as above. So what I should have is like below.

Compiler installation directory: C:\tdmgcc
C compiler: mingw32-gcc-4.6.1.exe
C++ compiler: mingw32-g++.exe
Linker for dynamic libs: mingw32-g++.exe
Linker for static libs: ar.exe
Debugger: gdb.exe
Resource compiler: windres.exe
Make program: mingw32-make.exe

Thanks, everyone.

Navigation

[0] Message Index

[*] Previous page

Go to full version