Solved

linking error with VC++ 5.0 linker

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Implementing a ResolveEventHandler in C++ 13 116
How to copy an image file into clipboard C/C++? 1 152
Safe conversion? 4 58
Installshield for Embarcadero EX 10.1 Berlin 4 20
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

895 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