Hi there,
When linking a project with a self-made library, the linker
is unable to find the relevant "__imp_Nnnn" symbols.
Discovered in C::B 20.03 / MinGW 8.1
I'm unable to determine if this is an error in how Code::Blocks
calls the GCC linker and archiver, or if it's a bug in ld.exe or ar.exe.
The command lines in the build log looks about right, but I notice
any Win32 libs the library depends on is not passed to gcc/g++
or ar when building the library.
How to recreate:
1) In a Win32 GUI project, write a function
that uses a Win32 function, f.ex. GradientFill.
Build and verify that the function is ok.
2) Create a static library project, migrate your function
to the lib, and verify that the lib builds ok.
3) Change your GUI project to use your lib function
instead of the original in-module function.
4) Try to rebuild your GUI app
--> Linker can't find the __imp_Nnnn.
I've put together a little project that demonstrates the bug
so you don't have to go out of your way to recreate it.
You'll find it in "GuiTest/GuiTest.workspace".
To see the bug, uncomment #include <gradrect.h> and rebuild.</gradrect.h>
Best Regards
// Love N
Looks like it's not a C::B bug, so it's better to post this in the
"Using Code::Blocks" forum for help.
Hi Andrew,
Could you please clarify that?
How else could the linker NOT find symbols that ARE there
in the linker libraries (proved by the example provided)?
Did you try building it at all?
WBR // Love
Before posting please read the following:
https://forums.codeblocks.org/index.php/topic,9996.0.html
It is not a C::B bug, but is how you setup the project and/or library. As such you need to ask for help, not create a bug report that is not a bug with C::B .
The following forum is where you need to post to request help in using C::B:
https://forums.codeblocks.org/index.php/board,3.0.html
Last edit: Andrew Cottrell 2021-11-09