Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 17th, 2010, 06:21 AM
Registered User
 
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default LNK2028 and LNK2019 errors

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
LNK1104 vs. (LNK2001 and LNK2019) digitaltruth Visual C++ 2005 0 January 26th, 2009 08:16 PM
errors LNK2001 and LNK2019 with VS .net 2005 rangalo Visual C++ 0 May 10th, 2006 03:07 AM
Unresolved External Symbol - LNK2019 Valke Visual C++ 2005 1 April 14th, 2006 02:44 PM
error lnk2019 Paula222 C++ Programming 3 February 27th, 2006 08:53 AM
error lnk2019 Paula222 Visual C++ 0 February 7th, 2006 06:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.