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:

[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

void my_func(); 
int main() 
{ 
    my_func(); 
    return 0; 
} 
void my_func() 
{ 
   ... 
}

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!

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.