469,934 Members | 1,883 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Visual C++ 6 Compilation Problem

Hi,
I am having problems compiling a small project in VC++ 6. I have
included the error below and the full project (including workspace) can
be downloaded here:
http://www.freebreakfast.co.uk/Example1.zip
I am new to C++ (esp. using multiple files) and I am not sure I have
structured the files right (with the correct includes etc). Any other
suggestions about the code would be greatly appreciated.
Also, how do I implement threading in C++. I have used threading in Java
before and so am familiar with the way in which they operate. Any
tutorials on the matter would be great. (I'm preferably looking for a
platform-independent solution but a Win32 method of doing this would
also be great)

Sorry for all the questions...

Thanks in advance,
Connell

Error Message which "Rebuilding All":
-------------------------------------

Compiling...
HeadNode.cpp
InternalNode.cpp
LinkedList.cpp
main.cpp
Node.cpp
ship.cpp
TailNode.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "public: __thiscall
LinkedList<class Ship>::LinkedList<class Ship>(void)"
(??0?$LinkedList@VShip@@@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: class Ship
* __thiscall LinkedList<class Ship>::GetNextObject(class Ship *)"
(?GetNextObject@?$LinkedList@VShip@@@@QAEPAVShip@@ PAV2@@Z)
main.obj : error LNK2001: unresolved external symbol "public: class Ship
* __thiscall LinkedList<class Ship>::GetFirstObject(void)"
(?GetFirstObject@?$LinkedList@VShip@@@@QAEPAVShip@ @XZ)
main.obj : error LNK2001: unresolved external symbol "public: void
__thiscall LinkedList<class Ship>::Insert(class Ship *)"
(?Insert@?$LinkedList@VShip@@@@QAEXPAVShip@@@Z)
Debug/Example1.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

Example1.exe - 5 error(s), 0 warning(s)
Jul 22 '05 #1
2 1395
On Wed, 21 Jul 2004 19:45:09 +0100, Connell Gauld
<co*****@freebreakfast.co.uk> wrote:
Hi,
I am having problems compiling a small project in VC++ 6. I have
included the error below and the full project (including workspace) can
be downloaded here:
http://www.freebreakfast.co.uk/Example1.zip
I am new to C++ (esp. using multiple files) and I am not sure I have
structured the files right (with the correct includes etc). Any other
suggestions about the code would be greatly appreciated.


Given that all your linker errors are template code this looks like the
classic template link error question. Probably the most commonly asked
question on this group.

You can find the answer in the FAQ

http://www.parashift.com/c++-faq-lit...html#faq-34.12

but the short answer is put all template code into header files.

john
Jul 22 '05 #2
On Wed, 21 Jul 2004 19:45:09 +0100, Connell Gauld wrote:
Also, how do I implement threading in C++. I have used threading in Java
before and so am familiar with the way in which they operate. Any
tutorials on the matter would be great. (I'm preferably looking for a
platform-independent solution but a Win32 method of doing this would
also be great)
The closest you're likely to get to platform-independent threads may be the
Boost libraries. See http://www.boost.org/ for details. I've also heard
some mention of ACE, but am not sure where to find it. For Win32 specific
methods, there are MS public newsgroups that would be better to ask in.
main.obj : error LNK2001: unresolved external symbol "public: __thiscall
LinkedList<class Ship>::LinkedList<class Ship>(void)"
(??0?$LinkedList@VShip@@@@QAE@XZ)


This isn't a compilation error, but a linking error. The problem is a very
common one involving templates. This is covered in the C++ FAQ found at
http://www.parashift.com/c++-faq-lite/ sections 34.12-34.15.

--
Greg Schmidt gr***@trawna.com
Trawna Publications http://www.trawna.com/
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Bruno Jouhier [MVP] | last post: by
reply views Thread by Bruno Jouhier [MVP] | last post: by
15 posts views Thread by Ken Allen | last post: by
2 posts views Thread by David++ | last post: by
2 posts views Thread by BobLaughland | last post: by
4 posts views Thread by Goran Djuranovic | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.