Visual C++ 6 Compilation Problem

C

Connell Gauld

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)
 
J

John Harrison

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-lite/containers-and-templates.html#faq-34.12

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

john
 
G

Greg Schmidt

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top