Can not build wxWidgets project

CodeLite installation/troubleshooting forum
souloser
CodeLite Curious
Posts: 4
Joined: Mon Aug 18, 2008 3:31 pm
Contact:

Can not build wxWidgets project

Post by souloser » Mon Aug 18, 2008 3:54 pm

I installed Mingw32 / wxWidgets / codelite

To build wxWidgets-2.8.8 I use:
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 USE_XRC=1
or
mingw32-make -f makefile.gcc BUILD=release UNICODE=1

When I build console wxWidgets sample(Simple main with wxWidgets enabled) , it's OK
When I build GUI wxWidgets sample(GUI application with main Frame) , not work , the out put is:

Code: Select all

Building: "C:/MinGW/bin/mingw32-make.EXE"  -j 2 -f "fff_wsp.mk" type=Debug
----------Building project:[ ddd - DebugUnicode ]----------
g++ -o ./DebugUnicode/ddd ./DebugUnicode/ddd_app.o ./DebugUnicode/ddd_frame.o    -O2  -mthreads -LC:\wxWidgets-2.8.8\lib\gcc_lib -lwxmsw28ud_html -lwxmsw28ud_adv -lwxmsw28ud_core -lwxbase28ud_xml -lwxbase28ud_net -lwxbase28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32  -mwindows
./DebugUnicode/ddd_app.o: In function `ZN6DddApp6OnInitEv':
E:/project/codelite/fff/ddd_app.cpp:21: undefined reference to `wxXmlResource::Get()'
E:/project/codelite/fff/ddd_app.cpp:21: undefined reference to `wxXmlResource::InitAllHandlers()'
collect2: ld returned 1 exit status
mingw32-make.EXE[1]: *** [DebugUnicode/ddd] Error 1
mingw32-make.EXE: *** [All] Error 2
----------Build Ended----------
For more , my Code:Blocks work well.

Sorry for my poor Enlish.

User avatar
eranif
CodeLite Plugin
Posts: 6110
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can not build wxWidgets project

Post by eranif » Mon Aug 18, 2008 4:34 pm

It looks like that wx-config tool is not output-ing the library which includes 'xrc'

can you list here the content of your:

<path/to/wxwidgets>/lib/gcc_dll/ or <path/to/wxwidgets>/lib/gcc_lib/ (am not sure if you are using dll or static library)

In addition, I would recommend building wxWidgets as monolithic/shared like this:

Code: Select all

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


or

Code: Select all

mingw32-make -f makefile.gcc UNICODE=1 SHARED=1 MONOLITHIC=1 BUILD=release
Eran
Make sure you have read the HOW TO POST thread

souloser
CodeLite Curious
Posts: 4
Joined: Mon Aug 18, 2008 3:31 pm
Contact:

Re: Can not build wxWidgets project

Post by souloser » Mon Aug 18, 2008 5:14 pm

My path to wxWidgets is "C:\wxWidgets-2.8.8\lib\gcc_lib"

Directory of C:\wxWidgets-2.8.8\lib\gcc_lib

2008-08-18 18:07 <DIR> .
2008-08-18 18:07 <DIR> ..
2008-08-18 17:54 53,053,494 libwxbase28ud.a
2008-08-18 17:55 12,836,600 libwxbase28ud_net.a
2008-08-18 18:04 508,466 libwxbase28ud_xml.a
2008-08-18 17:53 894,512 libwxexpatd.a
2008-08-18 17:52 1,252,228 libwxjpegd.a
2008-08-18 18:03 23,704,658 libwxmsw28ud_adv.a
2008-08-18 18:06 6,505,778 libwxmsw28ud_aui.a
2008-08-18 18:02 211,677,708 libwxmsw28ud_core.a
2008-08-18 18:04 18,861,992 libwxmsw28ud_html.a
2008-08-18 18:03 6,342,406 libwxmsw28ud_media.a
2008-08-18 18:07 11,488,402 libwxmsw28ud_richtext.a
2008-08-18 18:06 32,054,588 libwxmsw28ud_xrc.a
2008-08-18 17:52 646,784 libwxpngd.a
2008-08-18 17:52 294,320 libwxregexud.a
2008-08-18 17:52 13,962,304 libwxtiffd.a
2008-08-18 17:52 199,480 libwxzlibd.a
2008-08-17 21:44 <DIR> mswud
16 File(s) 394,283,720 bytes
3 Dir(s) 5,741,678,592 bytes free


Code: Select all

bool DddApp::OnInit()
{
	// Init resources and add the PNG handler
	wxSystemOptions::SetOption(_T("msw.remap"), 0);
	wxXmlResource::Get()->InitAllHandlers();
	wxImage::AddHandler( new wxPNGHandler );
	wxImage::AddHandler( new wxCURHandler );
	wxImage::AddHandler( new wxICOHandler );
	wxImage::AddHandler( new wxXPMHandler );
	wxImage::AddHandler( new wxGIFHandler );

	wxFrame* frame = new DddFrame(NULL,
                                   wxID_ANY,
                                   wxT("ddd"),
                                   wxDefaultPosition,
                                  wxSize(800, 600));
	


	frame->Show(TRUE);
	SetTopWindow(frame);
	return TRUE;
}

int DddApp::OnExit()
{
	return 0;
}
It not work

Code: Select all

bool DddApp::OnInit()
{
	// Init resources and add the PNG handler
	wxSystemOptions::SetOption(_T("msw.remap"), 0);
//	wxXmlResource::Get()->InitAllHandlers();
	wxImage::AddHandler( new wxPNGHandler );
	wxImage::AddHandler( new wxCURHandler );
	wxImage::AddHandler( new wxICOHandler );
	wxImage::AddHandler( new wxXPMHandler );
	wxImage::AddHandler( new wxGIFHandler );

	wxFrame* frame = new DddFrame(NULL,
                                   wxID_ANY,
                                   wxT("ddd"),
                                   wxDefaultPosition,
                                  wxSize(800, 600));
	


	frame->Show(TRUE);
	SetTopWindow(frame);
	return TRUE;
}

int DddApp::OnExit()
{
	return 0;
}
It wrok OK
Last edited by souloser on Mon Aug 18, 2008 5:21 pm, edited 1 time in total.

User avatar
eranif
CodeLite Plugin
Posts: 6110
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can not build wxWidgets project

Post by eranif » Mon Aug 18, 2008 5:17 pm

can u please list the content of '"C:\wxWidgets-2.8.8\lib\gcc_lib" here ?


Eran
Make sure you have read the HOW TO POST thread

souloser
CodeLite Curious
Posts: 4
Joined: Mon Aug 18, 2008 3:31 pm
Contact:

Re: Can not build wxWidgets project

Post by souloser » Mon Aug 18, 2008 5:22 pm

3rd floor

User avatar
eranif
CodeLite Plugin
Posts: 6110
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can not build wxWidgets project

Post by eranif » Mon Aug 18, 2008 5:28 pm

It seems that this library is not added during link time by wx-config tool:
libwxmsw28ud_xrc.a

to fix this:

Right click project and select 'settings ...'

In the settings, switch to the 'Linker' tab

In the 'Libraries' field, add this:

Code: Select all

;libwxmsw28ud_xrc.a;
(add semicolon before the lib name)

Uncomment your code, and compile it again

Eran
Make sure you have read the HOW TO POST thread

souloser
CodeLite Curious
Posts: 4
Joined: Mon Aug 18, 2008 3:31 pm
Contact:

Re: Can not build wxWidgets project

Post by souloser » Tue Aug 19, 2008 6:24 am

In the 'Libraries' field, it's this:

Code: Select all

wxmsw28ud_xrc
It Works fine !

Thank you !

Post Reply