Custom Static Library Issue  [SOLVED]

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
sam_des
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Aug 30, 2017 4:55 am

Custom Static Library Issue

Postby sam_des » Mon Dec 25, 2017 11:24 am

Hello,

I have WX application which compiles/runs good. Now I need a static Library of all my Custom Components which again I was able to generate using CodeBlocks. When I try to link this static lib with my application, I get linker complaining about of wxHtmlEasyPrinitng class references,

Code: Select all

||=== Build: Release in eT_AE_DL2_v100 (compiler: GNU GCC Compiler) ===|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::wxHtmlEasyPrinting(wxString const&, wxWindow*)'|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::SetStandardFonts(int, wxString const&, wxString const&)'|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::SetHeader(wxString const&, int)'|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::SetFooter(wxString const&, int)'|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::PreviewFile(wxString const&)'|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::PrintFile(wxString const&)'|
support\libeTLib.a(printing.o):printing.cpp|| undefined reference to `wxHtmlEasyPrinting::PageSetup()'|
||error: ld returned 1 exit status|
||=== Build failed: 8 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|


There are no issues with other WX classes. If I include the actual "printing.cpp", app links/runs fine. I checked the static lib & it indeed has "printing.o", generated from exact same "printing.cpp".

Do I need to need add something else while generating my static lib to resolve the wxHtmlEasyPrinting refs issue?

My setup is,
wxWidgets : 3.0.3 static linking
CodeBlocks : 16.01
Windows : 7/10
mingw : 4.9.2

Thanks in advance.
sam_des

stahta01
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 234
Joined: Fri Nov 03, 2006 2:00 pm

Re: Custom Static Library Issue  [SOLVED]

Postby stahta01 » Tue Dec 26, 2017 12:29 am

Remember the order of objects and libraries matter in MinGW GCC.

Post the link command and maybe the issue will be clear to someone on this board.

Tim S.

sam_des
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Aug 30, 2017 4:55 am

Re: Custom Static Library Issue

Postby sam_des » Tue Dec 26, 2017 3:12 am

Hello,

Remember the order of objects and libraries matter in MinGW GCC.


Thanks a lot. Weird but including my library before WX libs solved the issue.

sam_des

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Custom Static Library Issue

Postby eranon » Tue Dec 26, 2017 10:58 am

sam_des wrote:Weird but including my library before WX libs solved the issue.

Yes, as stahta01 stated, lib orders matters for GCC. GCC considers the libs from right to left (or from bottom to top talking about CodeBlocks GUI).

So, from top to bottom in C::B, you have to provide them like this:
3. Your libs
2. wxWidgets libs
1. System libs

Your libs depend on the wxWidgets ones which depend on the system ones.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]


Return to “Compiler / Linking / IDE Related”

Who is online

Users browsing this forum: Baidu [Spider] and 8 guests