Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solving "locally defined symbol imported" errors in VC++ 2015

I have a small command line program that uses Maxim's OneWire Public Domain API and WinUSB. It builds absolutely fine on my laptop using Win7/VS2013. Now I'm trying to move it to Win8.1/VS2015 on my new desktop PC, and I can't get it to build. Here are the errors reported:

1>------ Build started: Project: readtemp5, Configuration: Debug Win32 ------
1>presshum.obj : warning LNK4217: locally defined symbol _printf imported in function _print_array
1>readtemp.obj : warning LNK4049: locally defined symbol _printf imported
1>presshum.obj : warning LNK4217: locally defined symbol _sprintf_s imported in function _ReadPressHum
1>readtemp.obj : warning LNK4049: locally defined symbol _sprintf_s imported
1>temp10.obj : warning LNK4049: locally defined symbol _sprintf_s imported
1>presshum.obj : warning LNK4217: locally defined symbol _sprintf imported in function _ReadPressHum
1>temp10.obj : warning LNK4049: locally defined symbol _sprintf imported
1>readtemp.obj : warning LNK4217: locally defined symbol _fprintf imported in function _main
1>readtemp.obj : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _main
1>readtemp.obj : error LNK2019: unresolved external symbol __imp__scanf referenced in function _mainx
1>readtemp.obj : error LNK2019: unresolved external symbol __imp__sscanf referenced in function _main
1>readtemp.obj : error LNK2001: unresolved external symbol _owErrorStack
1>readtemp.obj : error LNK2001: unresolved external symbol _owErrorPointer
1>readtemp.obj : error LNK2001: unresolved external symbol _owErrorMsg
1>C:\Users\RowanB\Documents\Visual Studio 2015\Projects\readtemp5\readtemp5\Debug\readtemp5.exe : fatal error LNK1120: 6 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What does the error "locally defined symbol imported" actually mean? How do I find which line in which file is causing the problem?

What are the rules surrounding the symbol names with underscores? How do I work out what the original symbol names (i.e. the ones that I will see in source files) are?

I guess that the problem is probably that some header file or library or DLL is missing from the desktop PC, or are installed in a different place, and/or that I have not set up the project properties correctly to locate all the files needed. But how do I find out exactly what's wrong, and how to fix it?

I installed WDK on the new PC but it didn't install in the same place as on the laptop (C:\WinDDK). I can't actually find where it put it. Where are the WDK files?

Thanks - Rowan

like image 633
rowan.bradley Avatar asked Oct 20 '25 15:10

rowan.bradley


1 Answers

I had similar errors when switching between 2012 and 2015 compilers withing one working directory (going back and forth between two source control commits where one was still built with 2012 and another with 2015). The fix was simply to clean the solution and rebuild. If you copied the entire folder to your new PC, it is possible that intermediate build files from 2013 cause the problem.

like image 64
Vlad Avatar answered Oct 22 '25 04:10

Vlad