|
-
April 14th, 2010, 10:45 PM
#1
LNK2028 and LNK2019 errors
Hi! I am not sure if I'm in the right forum so please correct me.
Anyway, I am new to VC++ and I can’t get why I keep on getting these linking errors:
Cosgen is the name of my project.
------ Build started: Project: Cosgen, Configuration: Debug Win32 ------
Compiling...
Cosgen.cpp
Linking...
Cosgen.obj : error LNK2028: unresolved token (0A000017) "public: void __clrcall Cosgen::LinesDraw::hello(void)" (?hello@LinesDraw@Cosgen@@$$FQAMXXZ) referenced in function "private: void __clrcall Cosgen::Form1::linesB_Click(class System::Object ^,class System::EventArgs ^)" (?linesB_Click@Form1@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::Form1::linesB_Click(class System::Object ^,class System::EventArgs ^)" (?linesB_Click@Form1@Cosgen@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
C:\SP_C++\Cosgen\Debug\Cosgen.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\SP_C++\Cosgen\Cosgen\Debug\BuildLog.htm"
Cosgen - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here is my pseudocode:
//Form1.h
#include "LinesDraw.h" //I included the .h file
private: LinesDraw *ldraw;
ld = new LinesDraw; //I successfully made an object
ld->hello(); //and call the method from LinesDraw.h
//LinesDraw.h
void LinesDraw::hello();//hints that there is a method hello in LinesDraw
//LinesDraw.cpp
void LinesDraw::hello(){
int hello_num=3; //hello is implemented
)
Anyway, I want to implement it in the cpp file since I can’t run opengl functions in a .h file.
Form1.h is a managed file while LinesDraw.h is an unmanaged file.
Is it possible that I call a method in LinesDraw.h from Form1.h?
Also, I already tried putting __clrcall such as:
void __clrcall LinesDraw::hello();
and
void __clrcall LinesDraw::hello(){
int hello_num=3; //hello is implemented
)
But it didn’t work.
I’m really stuck right now and I don’t know what to do next.
So I will really appreciate it if you helped. Thanks!
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
|