Hi 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
Code:
#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
Code:
void LinesDraw::hello();//hints that there is a method hello in LinesDraw
//LinesDraw.cpp
Code:
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:
Code:
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!