Click here to Skip to main content
14,770,048 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
I have a program that links to a static library. This library has exported global variable.
This variable is defined in the .def file, but I get the following error:
unresolved external symbol __imp_XXX (where XXX is the variable name).

Does anyone knows the reason for that?
RedDk 21-Apr-13 15:24pm
Add the 8 characters "/VERBOSE" to the linker "Command Line"/"Additional Options". The next time you try to link a list of addresses the program is locating to search for that (assume) mangled variable name should make it clear that the where of the output you've compiled might not be there.
Michael Haephrati 21-Apr-13 15:26pm
I have done that, and the first time the variable is mentioned, is at the end, with the same error message:
unresolved external symbol __imp_XXX (where XXX is the variable name).

1 solution

In my case, what solved the problem was making sure that I only use $(SolutionDir)$(Platform)\$(Configuration)\ at any place that libraries are imported. :)
RedDk 21-Apr-13 16:26pm
Well, the thing is this. The linker is looking for this symbol and it's going through all the .lib that it can find. If you don't have the path explicitly named somewhere then the linker doen't know to look there.

I'd say to you try experimenting with an example that you've knowingly excluded the "look-in" variable. Compare that result from the Output tell to the pattern you got back when this missing library symbol couldn't be found. Any similarities? Etc ...
Michael Haephrati 21-Apr-13 16:51pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900