Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Visual-Studio
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?
Posted 21-Apr-13 10:10am
Comments
RedDK at 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 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

In my case, what solved the problem was making sure that I only use $(SolutionDir)$(Platform)\$(Configuration)\ at any place that libraries are imported. Smile | :)
  Permalink  
Comments
RedDK at 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 at 21-Apr-13 16:51pm
   
Correct

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

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 519
2 Maciej Los 305
3 BillWoodruff 250
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 21 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100