Failing to link my own function

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2006
Posts: 7
Reputation: grautu is an unknown quantity at this point 
Solved Threads: 0
grautu grautu is offline Offline
Newbie Poster

Failing to link my own function

 
0
  #1
Jun 3rd, 2006
Hi!
As a beginner in Borland C++ Builder I'm facing a Linker Error message which I have no idea of how to deal with. Concretely, my console project called as "my_proj" is calling the function my_func() whose code definition is included in the source file source.cpp (this source file is included in the directory C:\PROGRAMS\my_proj\ together with all the files related to my_proj project). Well, when compiling the project, the following error message appears:
  1. [Linker Error]Error:Unresolved external 'my_func()' referenced from C:\PROGRAMS\MY_PROJ\DEBUG_BUILD\SOURCE.OBJ
As for the relevant content of my source file, it looks something like that
  1. void my_func();
  2. int main()
  3. {
  4. my_func();
  5. return 0;
  6. }
  7. void my_func()
  8. {
  9. ...
  10. }
A certain IDE setting might be relevant. Concretely, at "Tools > Options > C++ Options", the C:\PROGRAMS directory is set to be both the BPI/LIB output directory and the Package output directory as well. I've chosen that setting since seemed to me in accordance with my intention that C:\PROGRAMS host all my C++ projects.
Could anybody please tell me something useful about how to overcome the mentioned linker error?
Notice this is my first program that involves user-built functions.
Thanks for any idea!
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,443
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 250
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Failing to link my own function

 
0
  #2
Jun 3rd, 2006
Originally Posted by grautu
Could anybody please tell me something useful about how to overcome the mentioned linker error?
Usually this means that much to your chagrin, you have not actually told the toolchain to build the file into your project.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 3
Reputation: sabuj is an unknown quantity at this point 
Solved Threads: 0
sabuj sabuj is offline Offline
Newbie Poster

Re: Failing to link my own function

 
0
  #3
Jun 7th, 2006
Make sure that the input locations(directories) that you have specified in the tools-options are correctly pointing to the required libraries and resources. Also check whether you missed a '\' in the directory name.(that is entering c:name instead of c:\name). Good luck
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC