What does this unresolved external symbol mean?

I get an error LNK2019: unresolved external symbol.  

1 unresolved externals.

What does this mean?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you declare a function, for example, and you main uses this function, but you forget to define the body of the function, then the linker cannot find the function. The function symbol is unresolved by the linker in that the linker cannot build the executable.
shaolinfunkAuthor Commented:
ok, so the function must be declared in the header file and defined before/above the main int() function?
You could also get the same error for variables.
lost_variable is declared, but if it is not defined, i.e.,
    int lost_variable;
somewhere, then it too will be an unresolved symbol.

Notice that if you can compile the code below with no problems. But you will still get an unresolved external symbol.
#include <iostream>
using namespace std;

extern int lost_variable;

int main() {
  cout << lost_variable << endl;

Open in new window

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

evilrixSenior Software Engineer (Avast)Commented:
>>  but you forget to define the body of the function
Or just forgot to link in the object file :)
I use "declare" as in:
   int foobar( int arg1, float arg2);
The declaration describes the function profile.

I use "define" as in:
   int foobar( int arg1, float arg2) {
      return arg1 + arg2;

The definition can be in a different file that is included in the project. In that case you need the declaration either in the .cpp file where it is used, or in a header file that is included when the foobar function is used.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shaolinfunkAuthor Commented:
thanks phoffric!!
Your welcome! Let me know when you get your program completely developed. I'd love to see how to analyze or automate the trades.
shaolinfunkAuthor Commented:
Will do Phoffric.  If you have any questions about automated trading I can probably help you as well.
Cool! Can you recommend a book on trading? (p.s. - I'm familiar with covered call/put options.)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.