Solved

linking error with VC++ 5.0 linker

Posted on 2000-03-25
4
241 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 10 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now