Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building in Microsoft Visual 2017 #7

Open
quickquestion1 opened this issue Aug 9, 2017 · 5 comments
Open

Building in Microsoft Visual 2017 #7

quickquestion1 opened this issue Aug 9, 2017 · 5 comments

Comments

@quickquestion1
Copy link

Building this in Microsoft Visual 2017 on windows 7 PC returns an error requiring an update to a pointer to updated SDK. This is easily fixed by simply clicking retarget solution.

Then rebuild returns an error that makes no sense seen below

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _sprintf referenced in function "public: void __thiscall CCyUSBDevice::UsbdStatusString(unsigned long,char *)" (?UsbdStatusString@CCyUSBDevice@@QAEXKPAD@Z) rtd2660 C:\YOURFILEPATH\RTD-2660-Programmer-master\RTD Programmer\CyAPI.lib(CyAPI.obj) 1

Double clicking on this error and MV2017 cannot even find the location to correct the syntax.
control + f search of entire build for _sprintf returns no results.

How do I correct a syntax error that doesn't exist?

(Obviously change YOURFILEPATH to your file path to get to the folder)

@ghent360
Copy link
Owner

ghent360 commented Aug 9, 2017 via email

@quickquestion1
Copy link
Author

quickquestion1 commented Aug 11, 2017

Did download another version of the CyAPI.lib and got the same error.
When I open CyAPI.lib in microsoft visual studio it appears as an indecipherable mess of hexidecimals in two columns and a third column with what appears to be some form of c++ code in a single long string. None of it contains any sprintf.

Could you upload the version of Microsoft Visual Studio that returns no build errors or any suggestions for if not fixing at least finding the error?

Alternatively if you could explain how to do this:
"The object file or library that contains the definition of the symbol is not linked. In Visual Studio, verify that the source file that contains the definition is built and linked as part of your project. On the command line, verify that the source file that contains the definition is compiled, and that the resulting object file is included in the list of files to link."
Nowhere in there does this manual explain how to actually link a file.
(project->properties is suggested by cypress but this has no link options)

Also thanks for uploading the code in the first place.

@hasaranga
Copy link

You need to link with legacy_stdio_definitions.lib and turn off ImageHasSafeExceptionHandlers

@bensaxophone
Copy link

@hasaranga Linking legacy_stdio_definitions.lib worked for me! Looks like VS introduced a universal C Runtime(CRT) in 2015 that got rid of the patchwork backwards compatibility that was available before. This breaks old libraries that rely on the old CRT. Microsoft actually recommends you upgrade your library to run on the Universal CRT. This article does a good job of explaining your options:

https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-160

@ghent360
Copy link
Owner

ghent360 commented Oct 3, 2021

Thank you. I have not compiled software for windows in 10 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants