Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

linking error with VC++ 5.0 linker

Posted on 2000-03-25
4
Medium Priority
?
253 Views
Last Modified: 2010-04-10
Hi,
 Has anyone here ever face this problem with the linker:

I try to link two object files but i got unresolve external symbol when it is so obvious that the linker should "see" the function.. ie(assume we have two files a.cpp and b.cpp):

//in a.cpp
 void myFunction()
{

}

//I call the function in b.cpp ..I "declare" the prototype in b.cpp "extern void myFunction()"(Although it is not necessary since it "extern" by default(It seems to behave that way normally..))

The linker gives out unresolve external as soon as it links those objs. FYI, I'm using MS IDE (never try on my own makefile :))

I'm using:
WINNT 4.0 SP6 VC++5.0
0
Comment
Question by:nisa
  • 2
4 Comments
 

Accepted Solution

by:
nichole earned 20 total points
ID: 2657173
try extern in your function as well as
your declares:

// declare in header
extern void myFunction();

// implementation
extern void myFunction()
{

}



0
 
LVL 9

Expert Comment

by:Pacman
ID: 2663719
Could you post your code of definition, declaration and call.
0
 
LVL 9

Expert Comment

by:Pacman
ID: 2663726
PS: "unresolved external" means NOT that your object isn't declared.
It means it's not DEFINED. This has nothing to do with your declaration.
0
 

Author Comment

by:nisa
ID: 2669100
Hi all,
   Sorry for late comment, anyway I tried to make another program in the same manner then it works(It should work anyway!!). However the one that I have problem with, is linked with someone elses object code that was compiled with VC++ 6.0(whereas i'm using VC++5.0). I should take a close look that those codes again :).


Best Regards,

Nisa.

Ps(Pacman): yes u are right "not DEFINE" is technically correct term for it , thanks for pointing that out :).
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question