473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

LNK2019 problems

I'm trying to make a linked list available to all my classes that need
to be able to access the list. I've made a header file Main.h (contents
below) that is being included in the relavent files. When I compile
with VC 2005 I get the following error.

1>------ Build started: Project: Backend, Configuration: Debug Win32
------
1>Compiling...
1>Main.cpp
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol "public:
__thiscall LinkedList<class Message *>::LinkedList<class Message
*>(void)" (??0?$LinkedList@PAVMessage@@@@QAE@XZ) referenced in function
_main
1>C:\Documents and Settings\Amanda\My Documents\Visual Studio
2005\Projects\Thesis\Debug\Backend.exe : fatal error LNK1120: 1
unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Amanda\My
Documents\Visual Studio
2005\Projects\Thesis\Backend\Debug\BuildLog.htm"
1>Backend - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
The contents of Main.h :
#include "Graph.h"
#include "Message.h"
#include "LinkedList.h"

extern LinkedList<Message** EmailMessages;

The contents of Main.cpp:
#include "Main.h"
#include "LinkedList.h"
#include "Message.h"

int main()
{
LinkedList<Message** EmailMessages = new LinkedList<Message*>();
//extern LinkedList<Message*EmailMessages;
return 0;
}
Any suggestions?

Sep 10 '06 #1
4 1362
wa****@gmail.com wrote:
I'm trying to make a linked list available to all my classes that need
to be able to access the list. I've made a header file Main.h (contents
below) that is being included in the relavent files. When I compile
with VC 2005 I get the following error.

1>------ Build started: Project: Backend, Configuration: Debug Win32
------
1>Compiling...
1>Main.cpp
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol "public:
__thiscall LinkedList<class Message *>::LinkedList<class Message
*>(void)" (??0?$LinkedList@PAVMessage@@@@QAE@XZ) referenced in function
_main
1>C:\Documents and Settings\Amanda\My Documents\Visual Studio
2005\Projects\Thesis\Debug\Backend.exe : fatal error LNK1120: 1
unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Amanda\My
Documents\Visual Studio
2005\Projects\Thesis\Backend\Debug\BuildLog.htm"
1>Backend - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
The contents of Main.h :
#include "Graph.h"
#include "Message.h"
#include "LinkedList.h"

extern LinkedList<Message** EmailMessages;

The contents of Main.cpp:
#include "Main.h"
#include "LinkedList.h"
#include "Message.h"
LinkedList<Message** EmailMessages;//changes here
int main()
{
EmailMessages = new LinkedList<Message*>(); //notices changes here
//extern LinkedList<Message*EmailMessages;
return 0;
}
Any suggestions?
You have to declare EmailMessages as a global variable in order to match
the extern linkage.

Sep 10 '06 #2

www.fruitfruit.com wrote:
wa****@gmail.com wrote:
I'm trying to make a linked list available to all my classes that need
to be able to access the list. I've made a header file Main.h (contents
below) that is being included in the relavent files. When I compile
with VC 2005 I get the following error.

1>------ Build started: Project: Backend, Configuration: Debug Win32
------
1>Compiling...
1>Main.cpp
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol "public:
__thiscall LinkedList<class Message *>::LinkedList<class Message
*>(void)" (??0?$LinkedList@PAVMessage@@@@QAE@XZ) referenced in function
_main
1>C:\Documents and Settings\Amanda\My Documents\Visual Studio
2005\Projects\Thesis\Debug\Backend.exe : fatal error LNK1120: 1
unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Amanda\My
Documents\Visual Studio
2005\Projects\Thesis\Backend\Debug\BuildLog.htm"
1>Backend - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
The contents of Main.h :
#include "Graph.h"
#include "Message.h"
#include "LinkedList.h"

extern LinkedList<Message** EmailMessages;

The contents of Main.cpp:
#include "Main.h"
#include "LinkedList.h"
#include "Message.h"
LinkedList<Message** EmailMessages;//changes here
int main()
{
EmailMessages = new LinkedList<Message*>(); //notices changes here
//extern LinkedList<Message*EmailMessages;
return 0;
}
Any suggestions?
You have to declare EmailMessages as a global variable in order to match
the extern linkage.
It made no changes to the error message.

Sep 10 '06 #3
wa****@gmail.com wrote in news:1157858752.240645.166450
@i3g2000cwc.googlegroups.com:
I'm trying to make a linked list available to all my classes that need
to be able to access the list. I've made a header file Main.h (contents
below) that is being included in the relavent files. When I compile
with VC 2005 I get the following error.
[snip]
>
Any suggestions?

In Main.cpp outside of the main() function add this line:

LinkedList<Message*>* EmailMessages = NULL;

--
Bryan Ecker
If I woke up looking like that I know I'd run at
the nearest living thing I saw, and kill it.
Sep 10 '06 #4
1>------ Build started: Project: Backend, Configuration: Debug Win32
------
1>Compiling...
1>Main.cpp
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol "public:
__thiscall LinkedList<class Message *>::LinkedList<class Message
*>(void)" (??0?$LinkedList@PAVMessage@@@@QAE@XZ) referenced in function
_main
You forgot to include LinkedList.cpp in your project?
Sep 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: drumdawg21 | last post by:
Ive been working on this problem for a long time now and really need some help. I have a program in c++ code that gives me build errors and my program is having problems. I have two source files in...
2
by: skrk_536 | last post by:
Hi I am usign VS 2003. Coding was done in VC++. When I compile my cod in debug mode I am not getting any error. When I compile the code i Release mode I am getting the following linker Error....
2
by: rangalo | last post by:
Hi All, I have succeeded in compiling a massive project, originally from vc6 to VS .Net 2005. Now, while linking I am having loads of linker errors with the above code. LNK20019 and LNK2001....
7
by: solarin | last post by:
Im having several problems with the error LNK2019. I ve a class that derives from another: //controller.h #include MessagesNotifier_Client class Controller : public...
1
by: en.navarro | last post by:
Im having several problems with the error LNK2019. I ve a class that derives from another: //controller.h #include MessagesNotifier_Client class Controller : public...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
1
by: girays | last post by:
I have a template class which name is EntityRepository and when I compile this class I get no error. But when I use this class in a main method I get LNK2019 linking error. std::map object is used...
4
by: jk2l | last post by:
Error 10 error LNK2019: unresolved external symbol __imp__glBindTexture@8 referenced in function "public: void __thiscall GLTexture::Use(void)" (?Use@GLTexture@@QAEXXZ) GLTexture.obj Error 11 error...
1
by: eraserwars | last post by:
I have been googeling every possible solution, but I cannot seem to fix LNK2019. My code is below, but I just cannot understand how anything related to LNK2019 from Microsoft's help center applies...
2
by: hjazz | last post by:
Hi all, I'm new to VS, and I'm using Visual Studio .NET 2003. I'm trying to write a program which uses pcap libraries. However, I keep getting the following errors: error LNK2019: unresolved...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.