Solved

linking error with VC++ 5.0 linker

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Template syntax for variable length arrays 9 75
convert char array to number in c 5 85
c++ getting the first 10 characters of a char* string 11 93
Header of docx file 17 102
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

786 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