Problem Linking Simple App

B

Brian J. Ackermann

Hi everybody,

I'm new to c++, and I'm working on this simple little application,
which ought to compile just fine, but I'm missing something. The
program has 4 file, 2 headers, and 2 cpp files. All files exist in
the same directory. The files compile fine, but when linking, I get
all these undefined references. The routines exist in
AboutDialog.cpp, and are declared in AboutDialog.h. Main.h references
AboutDialog.h, and Main.cpp references Main.h...

I can't see why it thinks the class is undefined, or whatever...I'm
sure its quite simple....

project1_main.o(.text+0x1166): In function
`ZN7MyFrame7OnAboutER14wxCommandEvent':
C:/WORK/P2/main.cpp:88: undefined reference to
`AboutDialog::AboutDialog(wxWindow*)'
project1_main.o(.text+0x11d7):C:/WORK/P2/main.cpp:89: undefined
reference to `AboutDialog::SetText(wxString const&)'
project1_main.o(.text+0x122e):C:/WORK/P2/main.cpp:90: undefined
reference to `AboutDialog::SetText2(wxString const&)'
make: *** [project1.exe] Error 1

Can anybody offer a suggestion? Thanks

Brian
 
M

Matthew Burgess

On 28 Jul 2003 10:30:44 -0700
Hi everybody,

I'm new to c++, and I'm working on this simple little application,
which ought to compile just fine, but I'm missing something. The
program has 4 file, 2 headers, and 2 cpp files. All files exist in
the same directory. The files compile fine, but when linking, I get
all these undefined references. The routines exist in
AboutDialog.cpp, and are declared in AboutDialog.h. Main.h references
AboutDialog.h, and Main.cpp references Main.h...

I can't see why it thinks the class is undefined, or whatever...I'm
sure its quite simple....

project1_main.o(.text+0x1166): In function
`ZN7MyFrame7OnAboutER14wxCommandEvent':
C:/WORK/P2/main.cpp:88: undefined reference to
`AboutDialog::AboutDialog(wxWindow*)'
project1_main.o(.text+0x11d7):C:/WORK/P2/main.cpp:89: undefined
reference to `AboutDialog::SetText(wxString const&)'
project1_main.o(.text+0x122e):C:/WORK/P2/main.cpp:90: undefined
reference to `AboutDialog::SetText2(wxString const&)'
make: *** [project1.exe] Error 1

Can anybody offer a suggestion? Thanks

Does main.cpp #include AboutDialog.h? If so, does AboutDialog.h define
such functions (note, not just functions with the same name, but
taking the type and number of arguments you've supplied in the
function call in main())? If so are you linking the files correctly -
see your compiler documentation for more info on that.

Hope this helps,

Matt.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top