Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: wiserlander en 28 Marzo 2013, 16:21 pm



Título: Problema al compilar con codeblocks y wxwidget [Solucionado]
Publicado por: wiserlander en 28 Marzo 2013, 16:21 pm
Hola, acabo de instalar Codeblocks en la versión que trae ya el compilador Mingw.

Seria esta versión que he instalado -> http://sourceforge.net/projects/codeblocks/files/Binaries/12.11/Windows/codeblocks-12.11mingw-setup.exe (http://sourceforge.net/projects/codeblocks/files/Binaries/12.11/Windows/codeblocks-12.11mingw-setup.exe)

Luego aplique la variable de entorno de sistema para el compilador, habiendo probado la variable de sistema y la de usuario también.

Luego descargue y compile WxWidget -> http://sourceforge.net/projects/wxwindows/files/2.9.4/wxMSW-2.9.4-Setup.exe/download (http://sourceforge.net/projects/wxwindows/files/2.9.4/wxMSW-2.9.4-Setup.exe/download)

Use lo siguiente para la compilación en el mismo orden en que están las lineas, pero esperando a que acabase cada proceso, todo sea dicho =)

Código:
mingw32-make -v

mingw32-make -f makefile.gcc clean

mingw32-make -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1 UNICODE=1

mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1

Y al parece se compilo correctamente.

Luego intente compilar una aplicación de Wxwidget, habiendo configurado el patch de WX en las ventanas que salen al crear un proyecto.

El caso es que segui un tutorial de youtube para hacer la instalación, por si alguien quiere ver el tutorial que seguí... -> http://youtu.be/QuPiZ86EFhQ (http://youtu.be/QuPiZ86EFhQ)

Y el resultado fue negativo, por que me muestra un montón de errores y como estoy empezando con conocimientos muy limitados sobre el tema, pues no se interpretarlos.

El volcado de la construcción es el siguiente:

Código:
obj\Debug\wsnApp.o||In function `WinMain@16':|
C:\Users\elhackerpuntonet\Desktop\c++\wsn\wsnApp.cpp|17|undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'|
obj\Debug\wsnApp.o||In function `Z11wxCreateAppv':|
C:\Users\elhackerpuntonet\Desktop\c++\wsn\wsnApp.cpp|17|undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'|
obj\Debug\wsnApp.o||In function `ZN6wsnApp6OnInitEv':|
C:\Users\elhackerpuntonet\Desktop\c++\wsn\wsnApp.cpp|23|undefined reference to `wxInitAllImageHandlers()'|
obj\Debug\wsnApp.o||In function `ZN23wxCriticalSectionLockerC1ER17wxCriticalSection':|
C:\wx\include\wx\thread.h|308|undefined reference to `wxCriticalSection::Enter()'|
obj\Debug\wsnApp.o||In function `ZN23wxCriticalSectionLockerD1Ev':|
C:\wx\include\wx\thread.h|313|undefined reference to `wxCriticalSection::Leave()'|
obj\Debug\wsnApp.o||In function `ZN12wxEvtHandler9TryParentER7wxEvent':|
C:\wx\include\wx\event.h|3353|undefined reference to `wxEvtHandler::DoTryApp(wxEvent&)'|
obj\Debug\wsnApp.o||In function `ZN16wxAppConsoleBase22SetInitializerFunctionEPFP12wxAppConsolevE':|
C:\wx\include\wx\app.h|409|undefined reference to `wxAppConsoleBase::ms_appInitFn'|
obj\Debug\wsnApp.o||In function `ZN16wxAppConsoleBase11GetInstanceEv':|
C:\wx\include\wx\app.h|417|undefined reference to `wxAppConsoleBase::ms_appInstance'|
obj\Debug\wsnApp.o||In function `ZN6wsnAppC1Ev':|
C:\Users\elhackerpuntonet\Desktop\c++\wsn\wsnApp.h|15|undefined reference to `wxApp::wxApp()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x8)||undefined reference to `wxApp::GetClassInfo() const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x14)||undefined reference to `wxObject::CreateRefData() const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x18)||undefined reference to `wxObject::CloneRefData(wxRefCounter const*) const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x24)||undefined reference to `wxEvtHandler::ProcessEvent(wxEvent&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x28)||undefined reference to `wxEvtHandler::QueueEvent(wxEvent*)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x30)||undefined reference to `wxEvtHandler::SearchEventTable(wxEventTable&, wxEvent&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x34)||undefined reference to `wxEvtHandler::TryBefore(wxEvent&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x38)||undefined reference to `wxEvtHandler::TryAfter(wxEvent&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x44)||undefined reference to `wxApp::GetEventTable() const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x48)||undefined reference to `wxApp::GetEventHashTable() const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x4c)||undefined reference to `wxEvtHandler::DoSetClientObject(wxClientData*)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x50)||undefined reference to `wxEvtHandler::DoGetClientObject() const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x54)||undefined reference to `wxEvtHandler::DoSetClientData(void*)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x58)||undefined reference to `wxEvtHandler::DoGetClientData() const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x5c)||undefined reference to `wxApp::Initialize(int&, wchar_t**)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x68)||undefined reference to `wxAppBase::OnRun()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x70)||undefined reference to `wxAppBase::OnExit()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x78)||undefined reference to `wxApp::CleanUp()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x80)||undefined reference to `wxAppConsoleBase::Exit()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x84)||undefined reference to `wxAppBase::OnInitCmdLine(wxCmdLineParser&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x88)||undefined reference to `wxAppBase::OnCmdLineParsed(wxCmdLineParser&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x8c)||undefined reference to `wxAppConsoleBase::OnCmdLineHelp(wxCmdLineParser&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x90)||undefined reference to `wxAppConsoleBase::OnCmdLineError(wxCmdLineParser&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x94)||undefined reference to `wxAppConsoleBase::FilterEvent(wxEvent&)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x98)||undefined reference to `wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0x9c)||undefined reference to `wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xa0)||undefined reference to `wxAppConsoleBase::OnUnhandledException()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xa4)||undefined reference to `wxApp::OnExceptionInMainLoop()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xa8)||undefined reference to `wxAppConsoleBase::ProcessPendingEvents()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xac)||undefined reference to `wxAppConsoleBase::Pending()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xb0)||undefined reference to `wxAppConsoleBase::Dispatch()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xb4)||undefined reference to `wxAppConsoleBase::MainLoop()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xb8)||undefined reference to `wxAppConsoleBase::ExitMainLoop()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xbc)||undefined reference to `wxApp::WakeUpIdle()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xc0)||undefined reference to `wxAppBase::ProcessIdle()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xc8)||undefined reference to `wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xcc)||undefined reference to `wxAppConsoleBase::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xd0)||undefined reference to `wxAppBase::CreateTraits()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xd4)||undefined reference to `wxAppBase::OnInitGui()'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xd8)||undefined reference to `wxAppBase::SafeYield(wxWindow*, bool)'|
obj\Debug\wsnApp.o:wsnApp.cpp:(.rdata$_ZTV6wsnApp[__ZTV6wsnApp]+0xdc)||undefined reference to `wxAppBase::SafeYieldFor(wxWindow*, long)'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 4 seconds) ===|


¿Alguien es tan amable de arrojar un poco de luz o recomendación?

Saludos y gracias!


Título: Re: Problema al compilar con codeblocks y wxwidget
Publicado por: naderST en 28 Marzo 2013, 16:32 pm
Por lo visto el problema es que no estás enlazando wxWidget


Título: Re: Problema al compilar con codeblocks y wxwidget
Publicado por: wiserlander en 28 Marzo 2013, 16:35 pm
Por lo visto el problema es que no estás enlazando wxWidget

Gracias por contestar tan rápido  =) voy a probar a configurar los linkers, si no me equivoco de las bibliotecas...

Edito: me perdí, creí que te referías a configurar el editor de variables globales de codeblocks para que supiera donde están el directorio de WX el de inlcude y el de lib, pero me sigue dando el mismo tipo de error.

Por otro lado le puse en Settings/Linker_settings las librerias de la carpeta gcc_lib disponibles pero sigue igual, con el mismo tipo de error.

Gracias


Título: Re: Problema al compilar con codeblocks y wxwidget
Publicado por: wiserlander en 28 Marzo 2013, 19:03 pm
Bien!  El problema ya está solucionado.

Los errores eran debido al path de las variables del sistema para el compilador, me confundí al crear la variable, ademas tenia otras apuntando en otras direcciones de instalaciones anteriores.

Solo tuve que borrarlas relativas y volver a crearlas nuevamente.

EDITO: Por si le pudiera servir a alguien...

Otro error que tuve fue al usar lo siguiente en la compilación de wxWidgets:

Código:
mingw32-make -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1 UNICODE=1

mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1

Según entendí de la fuente donde seguí otro tutorial para la compilación lo tenia que tener de la siguiente manera:

Código:
mingw32-make -f makefile.gcc BUILD=debug SHARED=1 MONOLITHIC=1 UNICODE=1

mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1

El único cambio es en SHARED = 1

Muchas gracias!