How to add the correct options to the g++ command

my os : windows xp sp3
compilers : gcc 4.5(minGW)
IDE : code blocks 10.05

I want to make the "CImg.h" work by code_block 10.05
but it always give me an error message

error: '_fileno' was not declared in this scope


When I Use the following command to compile a CImg-based program
with g++, on Windows, every thing is fixed
This is the command
 
g++ -o hello_word.exe hello_word.cpp -O2 -lgdi32

How could I adding the correct options to the g++ command by code_block?

Thanks a lot
Last edited on
Go to Build Options > Linker Settings > Link libraries > Add and enter gdi32
this wouldn't work, neither gdi32 or lgdi32 work
they would give me the same error message
try:
1- add "-lgdi32" to Build Options > Linker Settings - other linker options
or,
2- follow Bazzy's direction but add gdi32.lib or libgdi32.a manually, note that gdi32.lib only come with windows sdk
I try the way of Bazzy again, it works without enable -std=c++0x
How could I make it work with the -std=c++0x command?
I don't know how to key in the command from the command window or
make it work with code_block after adding -std=c++0x
Last edited on
Did you try to completely rebuild your program? What errors do you get if you enable C++0x?
I rebuild it already,this is the error message
error: '_fileno' was not declared in this scope
same as the first post since I enabled the -std=c++0xoption at that time
How did you enable -std=c++0x ? ( with C::B checkbox or typing it in Other Options )
Is the default g++ the same that C::B uses? ( you can check Compiler and Debugger > Toolchain Executables )
with C::B checkbox
I also try to type it on the command window

g++ -o hello_word.exe hello_word.cpp -O2 -lgdi32 -std=c++0x

But I got the same error message

ps : This library is made of a single header file CImg.h that must be included in your C++ source
Topic archived. No new replies allowed.