Page 1 of 1

Q: "undefined reference" error?

Posted: Sat Sep 04, 2010 2:16 am
by imalipusram
Dear experts,

i try to compile some code generated by someone else. However, I get some errors when linking. Are there some libraries wrongly specified?

I have created a new wxWindows GUI project, copied the source code into the same directory and added some other libraries (that came with the source code): one into the wxWidgets directory and another to the source code directory.

What might go wrong? Where could I check? What could I change?

My actual project also uses "MyFrame::MyFrame(wxString const&, wxPoint const&, wxSize const&)" and is built without any problems.
Possibly it's of importance that only main.o and main.o.d are generated, bit no *.o files of the other files of the project, as I'd have expected.

A quite confused newbie (to C++ AND CodeLite....)

Thanks for your help & suggstions!

Wo

Code: Select all

----------Build Started--------
C:\WINNT\system32\cmd.exe /c ""C:/MinGW-4.4.0/bin/mingw32-make.exe"  -j 1 -f "wxterminalwso_wsp.mk""
----------Building project:[ wo_term - Debug ]----------
mingw32-make[1]: Entering directory `C:/devel/wxterm/wxterminalwso'
g++ -c  "C:/devel/wxterm/wxterminalwso/main.cpp" -g -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.8.10\lib\gcc_dll\mswud -IC:\wxWidgets-2.8.10\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0    -D__WX__  -o ./Debug/main.o "-I." 
g++ -o ./Debug/wo_term ./Debug/main.o  "-L."   -mwindows  -mthreads -LC:\wxWidgets-2.8.10\lib\gcc_dll -lwxmsw28ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
./Debug/main.o:C:/devel/wxterm/wxterminalwso/main.cpp:130: undefined reference to `StartupDialog::StartupDialog(wxWindow*, int)'
./Debug/main.o:C:/devel/wxterm/wxterminalwso/main.cpp:140: undefined reference to `MyFrame::MyFrame(wxString const&, wxPoint const&, wxSize const&)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [Debug/wo_term] Error 1
mingw32-make[1]: Leaving directory `C:/devel/wxterm/wxterminalwso'
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
2 errors, 0 warnings, total time: 00:00:19 seconds

CodeLite 2.7.0.4375
wxWidgets 2.8.10
MinGW 4-4-0

OS: W2KSP4 in a VirtualBox PUEL 3.2.8. r64453
Host: OpenSuse Linux 11.1, Kernel 2.6.27.48-02-default

Re: Q: "undefined reference" error?

Posted: Sat Sep 04, 2010 9:42 am
by eranif
I can only see the linking stage, where is the compilation? did you compile your code?

Eran

Re: Q: "undefined reference" error?

Posted: Sat Sep 04, 2010 3:09 pm
by imalipusram
Hi Eran,

somehow the compiler line went missing in the snip. I have corrected it in the post above and added some more info - sorry.

Wo

Re: Q: "undefined reference" error?

Posted: Sun Sep 05, 2010 4:32 am
by imalipusram
Update - got a bit further now. I had not added the other source files to the project, so they didn't get compiled. Hopefully the missing object files were the reason for the "undefined reference" errors.

Am fighting wth some compiler error now, and am curious, if the previously mentiond "undefined references" will diappear...

/Wo