Hello Hello everyone! My codeblocks gave the error. undefined reference to `GetStockObject@4'| What is it? How to solve it, what to do to fix it? :'(
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
Do not tell the linker to look for libraries in a folder that does not exist!
mingw32-g++.exe -LG:\SDL\SDL-devel-1.2.15-mingw32\SDL-1.2.15\lib -LG:\SDK\Lib -LD:\CodeBlocks\MinGW\lib -o bin\Debug\WindowMain_0.exe obj\Debug\WindowMain_0.o -lmingw32 -lSDLmain -lSDL D:\CodeBlocks\MinGW\lib
Edit: If the folder does exist, then remove the folder from the "other linker options".
Tim S.
as told by stahta01 the problem comes certainly from this :
mingw32-g++.exe -LG:\SDL\SDL-devel-1.2.15-mingw32\SDL-1.2.15\lib -LG:\SDK\Lib -LD:\CodeBlocks\MinGW\lib -o bin\Debug\WindowMain_0.exe obj\Debug\WindowMain_0.o -lmingw32 -lSDLmain -lSDL D:\CodeBlocks\MinGW\lib
you set D:\CodeBlocks\MinGW\lib twice.
the first -LD:\CodeBlocks\MinGW\lib tell the linker where to find some libraries (-L option). This is probably good.
but the last one D:\CodeBlocks\MinGW\lib is certainly wrong. You have probably introduced this somewhere in your settings (other settings probably). Delete that wrong setting.
gd_on
The linker thinks "D:\CodeBlocks\MinGW\lib" is a library, but it is not. It is a folder.
You have to add the folder where the libraries are in
Project->Build options->Search directories->Linker
and the libraries only with name in
Project->Build options->Search directories->Linker settings->Link libraries
Do not add any library settings in "Project->Build options->Search directories->Linker settings->Other linker options"
or if you do keep atention that "-L" is for folders and "-l" is for libraries
in the line posted by stahta01:
mingw32-g++.exe -LG:\SDL\SDL-devel-1.2.15-mingw32\SDL-1.2.15\lib -LG:\SDK\Lib -LD:\CodeBlocks\MinGW\lib -o bin\Debug\WindowMain_0.exe obj\Debug\WindowMain_0.o -lmingw32 -lSDLmain -lSDL D:\CodeBlocks\MinGW\lib
You can see that has no option prefix ("-L" or "-l") so you have posted this in one place where you should not...
[Edit:] ok, someone was quicker, but i post it anyway