Author Topic: Compile error from auto-generated code: Panel1->Connect(wxEVT_PAINT....  (Read 5287 times)

Offline Aaron

  • Multiple posting newcomer
  • *
  • Posts: 59
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:
Code
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.

« Last Edit: March 26, 2015, 05:08:13 am by taSteve »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
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
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Aaron

  • Multiple posting newcomer
  • *
  • Posts: 59
That solved it.

Thank you.
I'm not sure how the EVT_PAINT paint event was added, or how I added it accidentally.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
You've probably double clicked on the panel in the ui editor...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]