Link to home
Start Free TrialLog in
Avatar of shaolinfunk
shaolinfunkFlag for United States of America

asked on

What does this unresolved external symbol mean?

I get an error LNK2019: unresolved external symbol.  

1 unresolved externals.

What does this mean?
Avatar of phoffric
phoffric

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.
Avatar of shaolinfunk

ASKER

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

>>  but you forget to define the body of the function
Or just forgot to link in the object file :)
ASKER CERTIFIED SOLUTION
Avatar of phoffric
phoffric

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.)