-
March 1st, 2010, 07:30 AM
#1
linking error
Hi please help. I am new to Visual C++ and I don't know how to solve these problems. Here is my code:
//LinesDialog.h
#include "LinesDraw.h"
ldraw.hello(); //hello function would then be called
//LinesDraw.h
public:
void hello();//hints that hello() exists
//LinesDraw.cpp
public: int num;
void LinesDraw::hello(){ //what the hello function does
num=3;
}
Cosgen.cpp is my main function.
And here is the linking error that I got:
LinesDraw.obj : error LNK2028: unresolved token (0A000011) "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::LinesDialog::submitLDB_Click(class System::Object ^,class System::EventArgs ^)" (?submitLDB_Click@LinesDialog@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
Cosgen.obj : error LNK2028: unresolved token (0A00003E) "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::LinesDialog::submitLDB_Click(class System::Object ^,class System::EventArgs ^)" (?submitLDB_Click@LinesDialog@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
Cosgen.obj : error LNK2019: unresolved external symbol "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::LinesDialog::submitLDB_Click(class System::Object ^,class System::EventArgs ^)" (?submitLDB_Click@LinesDialog@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
LinesDraw.obj : error LNK2001: unresolved external symbol "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ)
C:\SP_C++\Cosgen\Debug\Cosgen.exe : fatal error LNK1120: 3 unresolved externals
I tried to google and stalk in some forums but I couldn't solve it.
Help from you expert people would be very much appreciated.
And I hoped that I am in the right forum.
Anyway, Cosgen is the name of my project.
Thanks!
-
March 6th, 2010, 04:34 PM
#2
Re: linking error
This code makes no sense. Please post the actual code.
There error messages say that there are functions that are declared (in a header) but not implemented (in a cpp file), so that the linker doesn't find the body and link it in the resulting executable.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|