User forums > Using Code::Blocks
Static library issue
(1/1)
lwbbs:
Hello,
I tried to create a static library. It include a download function which uses wininet functions, such as InternetOpen, etc.
The static library can be compiled without error.
But when I tried to use the static library in other application, MinGW reports some errors when link to the static library:
C:/MinGW/msys/1.0/home/lwbbs/workspace/download.cpp:46: undefined reference to `InternetOpenA@20'
Code::Blocks version: 10.05
Would you please tell me how to fix it?
Thanks.
oBFusCATed:
Static libs don't store dependency info in the, thus you have to add the appropriate libraries to the executable/dynamic lib using the static libs.
lwbbs:
Thanks for your information.
In my executable project, I have included wininet in the linker setting.
<Linker>
<Add library="wininet" />
</Linker>
The attached file is the setting window.
I don't know why it still reports the error.
--- Quote from: oBFusCATed on May 20, 2011, 10:23:07 am ---Static libs don't store dependency info in the, thus you have to add the appropriate libraries to the executable/dynamic lib using the static libs.
--- End quote ---
MortenMacFly:
--- Quote from: lwbbs on May 20, 2011, 10:32:14 am ---I don't know why it still reports the error.
--- End quote ---
Because the linker still cannot find the reference. Thus the library you added does not provide a feasible implementation for the method (InternetOpenA) you are using. Find the right library.
As this is not a Code::Blocks related question I've locked the topic now, as it violates our forum rules.
Navigation
[0] Message Index
Go to full version