News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

undefined reference to `GetStockObject@4'|

Started by Дмитро, October 18, 2019, 08:03:08 PM

Previous topic - Next topic

Дмитро

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? :'(

Code (mysql) Select
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);


Дмитро

Yes, I find in myself really. D:\CodeBlocks\MinGW\lib\libgdi32.a

Дмитро

I am running Code::Blocks version 17ю12 on windows
(version 7). The compiler I use is MinGW
version 5.1.0.

Дмитро

What settings kodeblocksiv should be performed to correctly find libgdi32.a? How is it before, for years, I have not met the problem of finding ordinary libraries?

Дмитро

||error: :\CodeBlocks\MinGW\lib: Invalid argument|

Дмитро

ld.exe||cannot find D:\CodeBlocks\MinGW\lib: Permission denied|

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Дмитро

#8
Yes, I am still unable to resolve this issue, unable to understand where there are troubles.

Дмитро

#9
Have I provided all the necessary information and information?

BlueHazzard

What is in "D:\CodeBlocks\MinGW\lib"?
have you added it by yourself?

stahta01

#11
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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Дмитро

No, it's still not clear to me how to fix the error.

Actually, the one needed on the computer was originally, is, and has its own address D: \ CodeBlocks \ MinGW \ lib inside this folder.
Also, there are many other libs, for example libvideoprt.a, and so on, about 144 libs.

For a long time, actually years earlier, I did not carefully consider this.
Added only other third-party inclusions and libs.

In addition, there are also D: \ CodeBlocks \ MinGW \ bin paths, inside which there are compilers and some many dlls.
And there is also a path and a folder D: \ CodeBlocks \ MinGW \ include, with various inclusions inside it, and in it there are subfolders
D: \ CodeBlocks \ MinGW \ include \ GL, D: \ CodeBlocks \ MinGW \ include \ sys, D: \ CodeBlocks \ MinGW \ include \ gdiplus, D: \ CodeBlocks \ MinGW \ include \ ddk also containing inclusions too.

Also along the path D: \ CodeBlocks \ MinGW \ libexec \ gcc \ mingw32 \ 5.1.0 also with programs and containing dll and for example collect2.exe, and deeper inside this folder there is also a folder D: \ CodeBlocks \ MinGW \ libexec \ gcc \ mingw32 \ 5.1.0 \ install-tools containing fixincl.exe and files.
Also along the path D: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 there are many .a libraries, among them, for example, libatomic.a, one file libstdc .dll.a-gdb.py, several .o, inside this folder also contains the folder D: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include containing a lot of .h files, for example avx512bwintrin.h, and inside it the folder D: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c, which also contains many folders, many files, and many complex nesting levels inside.
Here inside
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ tr2 \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ tr1 \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ profile \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ parallel \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ mingw32 \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ ext \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ experimental \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ decimal \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ debug \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ bits \
d: \ CodeBlocks \ MinGW \ lib \ gcc \ mingw32 \ 5.1.0 \ include \ c \ backward \

Still everywhere around and inside and also in the depths and everywhere there are many and especially many folders, subfolders and everywhere there are many complicated folders and paths.
I'm reviewing and studying at this moment, I was a little surprised at the many complexity of the structure of subfolders.



And now, of course, I want to configure my codeblocks always so that it works always correctly and has a good one.

Дмитро

In short, all the specified folders are there, the paths are correct. There is a necessary lib. I can't, I don't know how to set the correct settings for codeblocks. His work as a whole suits me, except for the moment indicated in the title of the topic.

gd_on

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
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).