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.
Hello, I am new to wxWidgets, mostly spent my time programming in Java and Python, in other IDEs. Anyways, I am trying to create a simple program and it seems that I cannot compile it because of problems with linking. What could possibly cause these errors?
I am using the MinGW compiler packaged with Code::Blocks, and I am using wxWidgets binaries. They are properly set up, and I don't think that I am missing any files.
MinGW compiler packaged with Code::Blocks, and I am using wxWidgets binaries
Which binaries? On the wxWidgets download page i only see binaries for MinGW 7.3 and 8.1. AFAIK CodeBlocks comes with an older 5.1.
Try switching the compiler to one of those, or try building wxWidgets from scratch. Here's a complete step-by-step tutorial: viewtopic.php?f=19&t=46125
||=== Build: Debug in Build1 (compiler: GNU GCC Compiler) ===|
obj\Debug\Build1App.o||In function `WinMain':|
C:\Users\Cianne\Documents\Build1\Build1App.cpp|18|undefined reference to `__imp__Z7wxEntryP11HINSTANCE__S0_Pci'|
obj\Debug\Build1App.o||In function `wxCreateApp()':|
C:\Users\Cianne\Documents\Build1\Build1App.cpp|18|undefined reference to `__imp__ZN16wxAppConsoleBase17CheckBuildOptionsEPKcS1_'|
obj\Debug\Build1App.o||In function `Build1App::OnInit()':|
C:\Users\Cianne\Documents\Build1\Build1App.cpp|24|undefined reference to `__imp__Z22wxInitAllImageHandlersv'|
obj\Debug\Build1App.o||In function `wxAppConsoleBase::SetInitializerFunction(wxAppConsole* (*)())':|
D:\backup\wx\include\wx\app.h|454|undefined reference to `__imp__ZN16wxAppConsoleBase12ms_appInitFnE'|
obj\Debug\Build1App.o||In function `wxAppConsoleBase::GetInstance()':|
D:\backup\wx\include\wx\app.h|462|undefined reference to `__imp__ZN16wxAppConsoleBase14ms_appInstanceE'|
obj\Debug\Build1App.o||In function `Build1App::Build1App()':|
C:\Users\Cianne\Documents\Build1\Build1App.h|15|undefined reference to `__imp__ZN5wxAppC2Ev'|
obj\Debug\Build1App.o:Build1App.cpp:(.rdata$_ZTV9Build1App[_ZTV9Build1App]+0x10)||undefined reference to `wxApp::GetClassInfo() const'|
obj\Debug\Build1App.o:Build1App.cpp:(.rdata$_ZTV9Build1App[_ZTV9Build1App]+0x28)||undefined reference to `wxObject::CreateRefData() const'|
obj\Debug\Build1App.o:Build1App.cpp:(.rdata$_ZTV9Build1App[_ZTV9Build1App]+0x30)||undefined reference to `wxObject::CloneRefData(wxRefCounter const*) const'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|
Looks like all the wxWidgets libraries are missing in the linker settings. This is all described in the link i posted.
I still recommend to build wxWidgets and the "minimal" sample that comes with it from scratch before using CodeBlocks. Then you know everything is ok on the compiler and wx side and all problems are caused by CB configuration.