This is a simple test project that began by adding a wxPanel to a wxFrame, then a few controls.
This autogenerated code line causes the error on build:
Panel1->Connect(wxEVT_PAINT,(wxObjectEventFunction)&wxPanel4Frame::OnPanel1Paint,0,this);
Build Log:
-------------- Build: Release in wxPanel4 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswu -c "C:\Documents and Settings\Stv.XPWS02\Desktop\Briefcase\Cpp Projects\CodeBlocks\wxWidgets_projs\wxPanel4\dlg.cpp" -o obj\Release\dlg.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswu -c "C:\Documents and Settings\Stv.XPWS02\Desktop\Briefcase\Cpp Projects\CodeBlocks\wxWidgets_projs\wxPanel4\wxFrame1.cpp" -o obj\Release\wxFrame1.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswu -c "C:\Documents and Settings\Stv.XPWS02\Desktop\Briefcase\Cpp Projects\CodeBlocks\wxWidgets_projs\wxPanel4\wxFrame2.cpp" -o obj\Release\wxFrame2.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswu -c "C:\Documents and Settings\Stv.XPWS02\Desktop\Briefcase\Cpp Projects\CodeBlocks\wxWidgets_projs\wxPanel4\wxPanel4Main.cpp" -o obj\Release\wxPanel4Main.o
mingw32-g++.exe -LC:\wxWidgets-3.0.2\lib\gcc_lib -L"C:\Program Files\CodeBlocks\MinGW\bin" -o bin\Release\wxPanel4.exe obj\Release\dlg.o obj\Release\wxFrame1.o obj\Release\wxFrame2.o obj\Release\wxPanel4App.o obj\Release\wxPanel4Main.o obj\Release\resource.res -s -mthreads -lwxmsw30u -lwxpng -lwxjpeg -lwxtiff -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
obj\Release\wxPanel4Main.o:wxPanel4Main.cpp:(.text+0x5adf): undefined reference to `wxPanel4Frame::OnPanel1Paint(wxPaintEvent&)'
obj\Release\wxPanel4Main.o:wxPanel4Main.cpp:(.text+0x9c5f): undefined reference to `wxPanel4Frame::OnPanel1Paint(wxPaintEvent&)'
collect2: ld returned 1 exit status
Process terminated with status 1 (3 minute(s), 26 second(s))
2 error(s), 0 warning(s) (3 minute(s), 26 second(s))
----------------------- end build log ------------------------------------------
When I comment the Panel1 line, the Build is without errors. But later during other file edits, my comment marks (//) mysteriously disappear.
When deleted, the line reappeared.
So I need to define a reference to 'wxPanel4Frame::OnPanelPaint(wxPaintEvent&)' I am not sure where or how.
The project EXE file works perfectly with the line commented.
I can post more code if necessary.
(using C::B 13.12, wxWidgets 3.0.2, Win XP)
Any suggestions appreciated.
Do you have wxPanel4Frame class? If you have just define the function.
If you don't want to override the paint event in this panel then just:
1. find it in the tree of controls
2. switch to the event tab in the properties control
3. remove the function for the paint event
That solved it.
Thank you.
I'm not sure how the EVT_PAINT paint event was added, or how I added it accidentally.
You've probably double clicked on the panel in the ui editor...