473,503 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's wrong with this linking?

I wrote a simple program (in which I reused a data structure), but it
refuses to link. Can anyone here please help me?

Notice that Region2D.cpp IS in the compilation, and the "unresolved"
functions DO exist there!

I'm using Microsoft Visual C++ 6.0.
The output for the Rebuild All:

Compiling...
main.cpp
QuadMesh.cpp
QuadTree.cpp
Region2D.cpp
Tree.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "public: virtual
__thiscall Rage::NTree::Region2D<char>::~Region2D<char>(void) "
(??1?$Region2D@D@NTree@Rage@@UAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: void
__thiscall Rage::NTree::Region2D<char>::initialize(int,int,ch ar *)"
(?initialize@?$Region2D@D@NTree@Rage@@QAEXHHPAD@Z)
main.obj : error LNK2001: unresolved external symbol "public:
__thiscall Rage::NTree::Region2D<char>::Region2D<char>(void)"
(??0?$Region2D@D@NTree@Rage@@QAE@XZ)
Debug/Rage.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

Rage.exe - 4 error(s), 0 warning(s)

The source files are here:
http://www.cc.jct.ac.il/~shaneh/qtree.zip
Jul 22 '05 #1
1 1243

"Orgad" <sh****@jct.ac.il> wrote in message
news:5c*************************@posting.google.co m...
I wrote a simple program (in which I reused a data structure), but it
refuses to link. Can anyone here please help me?

Notice that Region2D.cpp IS in the compilation, and the "unresolved"
functions DO exist there!


But that's the wrong place!!

Template functions and classes should always go in header files, otherwise
you will get linking problems.

This is a FAQ 'How can I avoid linker errors with my template classes',
http://www.parashift.com/c++-faq-lit...html#faq-34.14

john
Jul 22 '05 #2

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

Similar topics

7
4349
by: BekTek | last post by:
When I build boost libs, I realized that there is static link at runtime.. What does that mean? I thought static linking is done at compile time. Am I wrong?
2
2502
by: serge | last post by:
/* This is a long post. You can paste the whole message in the SQL Query Analyzer. I have a scenario where there are records with values pointing to wrong records and I need to fix them using an...
20
3197
by: Steven T. Hatton | last post by:
I just read this in the description of how C++ is supposed to be implemented: "All external object and function references are resolved. Library components are linked to satisfy external...
15
13024
by: XZ | last post by:
Hi everyone, this is really confusing to me: #include <stdio.h> main(int argc, char **argv) { printf("argv = %f\n",(double)atof(argv)); printf("argv = %d\n\n",atoi(argv)); } $ a.out a argv...
2
1078
by: Jason Jacob | last post by:
To all I am new to MS's VC++ and got a question. I've tried to write a simple console program "HelloWorld.cpp", then I've added a simple class (Class01.h and cpp) Class01 compile well, but...
1
1471
by: g35rider | last post by:
Hi, I am trying to understand from C++ point of view what the problem is. I have a file called. Controllers.h in which I have a base class Controller and couple of other sub classes...
83
3852
by: Anonymous | last post by:
Came across some code summarized as follows: char const* MyClass::errToText(int err) const { switch (err) { case 0: return "No error"; case 1: return "Not enough"; case 2: return "Too...
20
2104
by: pratap | last post by:
Could someone clarify how could one reduce the size of an executable code during compile time. Could one use specific compile time flag with makefile or is it advisable to go for dynamic linking....
10
1773
by: DavidSeck.com | last post by:
Hi, I am working with the Facebook API right now, an I have kind of a problem, but I don't know what I am doing wrong. So I have a few arrays, f.ex.: User albums: array(2) {
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
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
7342
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...
1
6998
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
5586
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,...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.