Hello
I am having an issue with syntax.
I have:

wxLegendWindow::wxLegendWindow( wxWindow *parent) : wxWindow(parent, -1, wxDefaultPosition, wxSize(LEGEND_WIDTH,LEGEND_HEIGHT)) m_WinParent(parent)

and when I compile I get:

C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: expected '{' before 'm_WinParent'|

The code I originally started with was:

wxLegendWindow::wxLegendWindow(
	 wxWindow *parent
):  wxWindow(parent, -1, wxDefaultPosition, 
			 wxSize(LEGEND_WIDTH, LEGEND_HEIGHT)/*, wxSIMPLE_BORDER*/),
	m_WinParent(parent)

However this raises the error:

C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|54|undefined reference to `_imp___ZN8wxLegendC1Ev'

I am not sure if this is "just" a syntax issue or a missing library.

My Build log follows:

-------------- Build: default in wxChart3 ---------------

mingw32-g++.exe  -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE  -Wall   -IC:\codeblocks-10.05-release\src\include -IC:\codeblocks-10.05-release\src\sdk\wxscintilla\include -IC:\wxWidgets-2.8.12\include -IC:\wxWidgets-2.8.12\lib\gcc_dll\mswu -IC:\codeblocks-10.05-release\src\plugins\contrib\wxSmith -IC:\codeblocks-10.05-release\src\plugins\contrib\wxSmith\wxwidgets -IC:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include -IC:\codeblocks-10.05-release\src\plugins\contrib\wxSmith\propgrid\contrib\include -I"C:\Documents and Settings\rdgriego\My Documents\Downloads\mysql-connector-c-noinstall-6.0.2-win32-vs2005\mysql-connector-c-noinstall-6.0.2-win32-vs2005\include"  -c C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp -o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o
In file included from C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp:32:
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include/wx/legendwindow.h:40: warning: attribute ignored in declaration of 'class wxLegendWindow'
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include/wx/legendwindow.h:40: warning: attribute for 'class wxLegendWindow' must follow the 'class' keyword
mingw32-g++.exe -shared   -Wl,--dll -LC:\codeblocks-10.05-release\src\devel -LC:\wxWidgets-2.8.12\lib\gcc_dll -L"C:\Documents and Settings\rdgriego\My Documents\Downloads\mysql-connector-c-noinstall-6.0.2-win32-vs2005\mysql-connector-c-noinstall-6.0.2-win32-vs2005\lib"  .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\axis.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\bar3dchartpoints.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\barchartpoints.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\chart.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\chartcolors.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\chartctrl.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\chartsizes.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\chartwindow.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\label.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legend.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\pie3dchartpoints.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\piechartpoints.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\points.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\xaxis.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\xaxiswindow.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\yaxis.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\yaxiswindow.o .objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxschart.o   -o wxChart3.dll -mthreads  -lwxsmithlib -lcodeblocks -lwxmsw28u C:\WINDOWS\system32\sqlsrv32.dll "C:\Program Files\CodeBlocks\MinGW\lib\libodbc32.a" C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28_core.a 
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o: In function `wxLegendWindow':
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:54: undefined reference to `_imp___ZN8wxLegendC1Ev'
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:57: undefined reference to `_imp___ZN8wxLegendD1Ev'
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:54: undefined reference to `_imp___ZN8wxLegendC1Ev'
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:57: undefined reference to `_imp___ZN8wxLegendD1Ev'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:71: undefined reference to `_imp___ZN8wxLegend3AddERK8wxStringRKm'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:82: undefined reference to `_imp___ZN8wxLegend5ClearEv'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:93: undefined reference to `_imp___ZNK8wxLegend8GetCountEv'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:106: undefined reference to `_imp___ZNK8wxLegend8GetColorEi'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:119: undefined reference to `_imp___ZNK8wxLegend8GetLabelEi'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:147: undefined reference to `_imp___ZN8wxLegend4DrawEP4wxDCP10CHART_RECT'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:180: undefined reference to `_imp___ZN8wxLegend13IsInArrowDownEii'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:182: undefined reference to `_imp___ZN8wxLegend7DecPageEv'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:185: undefined reference to `_imp___ZN8wxLegend11IsInArrowUpEii'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:187: undefined reference to `_imp___ZN8wxLegend7IncPageEv'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:206: undefined reference to `_imp___ZN8wxLegend13IsInArrowDownEii'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:208: undefined reference to `_imp___ZN8wxLegend9DrawArrowEP4wxDCib'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:210: undefined reference to `_imp___ZN8wxLegend11IsInArrowUpEii'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:212: undefined reference to `_imp___ZN8wxLegend9DrawArrowEP4wxDCib'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:216: undefined reference to `_imp___ZN8wxLegend9DrawArrowEP4wxDCib'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o:C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/src/legendwindow.cpp:217: undefined reference to `_imp___ZN8wxLegend9DrawArrowEP4wxDCib'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o: In function `wxLegendWindow':
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/include/wx/legendwindow.h:42: undefined reference to `_imp___ZN8wxLegendC1Ev'
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/include/wx/legendwindow.h:42: undefined reference to `_imp___ZN8wxLegendC1Ev'
.objs\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.o: In function `~wxLegendWindow':
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/include/wx/legendwindow.h:40: undefined reference to `_imp___ZN8wxLegendD1Ev'
C:/codeblocks-10.05-release/src/plugins/contrib/wxSmithContribItems/wxchart/wxchart-1.0/include/wx/legendwindow.h:40: undefined reference to `_imp___ZN8wxLegendD1Ev'
collect2: ld returned 1 exit status
Info: resolving vtable for wxsWidget by linking to __imp___ZTV9wxsWidget (auto-import)
Info: resolving vtable for wxsFlagsProperty by linking to __imp___ZTV16wxsFlagsProperty (auto-import)
Process terminated with status 1 (0 minutes, 5 seconds)
24 errors, 3 warnings

Thank you.

Recommended Answers

All 5 Replies

My guess is the problem is the :

wxLegendWindow::wxLegendWindow( wxWindow *parent) ; // <<<< replace the colon
wxWindow(parent, -1, wxDefaultPosition, wxSize(LEGEND_WIDTH,LEGEND_HEIGHT)) m_WinParent(parent);

Another possibility is that there are too many )

wxLegendWindow::wxLegendWindow( wxWindow *parent, 
wxWindow(parent, -1, wxDefaultPosition, wxSize(LEGEND_WIDTH,LEGEND_HEIGHT), m_WinParent(parent));

\

Thanks for the answer.
Neither of the proposed changes made it work though.
In case 1 the error are:

C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|40|warning: attribute ignored in declaration of 'class wxLegendWindow'|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|40|warning: attribute for 'class wxLegendWindow' must follow the 'class' keyword|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: declaration of 'wxLegendWindow::wxLegendWindow(wxWindow*)' outside of class is not definition|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: expected ')' before ',' token|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: expected unqualified-id before '-' token|
||=== Build finished: 3 errors, 2 warnings ===|

The second case gives me:

C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|40|warning: attribute ignored in declaration of 'class wxLegendWindow'|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|40|warning: attribute for 'class wxLegendWindow' must follow the 'class' keyword|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: expected ')' before ',' token|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: expected ')' before ',' token|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: prototype for 'wxLegendWindow::wxLegendWindow(...)' does not match any in class 'wxLegendWindow'|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|40|error: candidates are: wxLegendWindow::wxLegendWindow(const wxLegendWindow&)|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|43|error:                 wxLegendWindow::wxLegendWindow(wxWindow*)|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\include\wx\legendwindow.h|42|error:                 wxLegendWindow::wxLegendWindow()|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|50|error: expected unqualified-id before '-' token|
C:\codeblocks-10.05-release\src\plugins\contrib\wxSmithContribItems\wxchart\wxchart-1.0\src\legendwindow.cpp|52|error: expected unqualified-id before '{' token|
||=== Build finished: 8 errors, 2 warnings ===|

The correct code you want is here. You probably made a mistake copying the code. Or you did not include the correct header files #include <wx/wxprec.h>

Sorry for the delay, <wx/wxprec.h> is included and the code for both files is identical. I believe the issue is with the linked libraries, as in I don't have them correct. Hopefully I will get a chance to work on it more this week.

Thank you.

The errors you posted have nothing to do with the libraries because the compiler has not gotten that far yet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.