ghent360 / RTD-2660-Programmer

Realtek RTD2660/2662 programmer
BSD 3-Clause "New" or "Revised" License
97 stars 40 forks source link

Building in Microsoft Visual 2017 #7

Open quickquestion1 opened 6 years ago

quickquestion1 commented 6 years ago

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 commented 6 years ago

Obviously the project is quite old and new visual studio brings new issues. The error seems to come from the Cypress CyAPI library. You may try to get a new version from Cypress.

~V

On Aug 8, 2017 6:05 PM, "quickquestion1" notifications@github.com wrote:

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)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ghent360/RTD-2660-Programmer/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxY1t9a41XfhyIvJNJyjMRnANCA1tJmks5sWQW8gaJpZM4OxeR1 .

quickquestion1 commented 6 years ago

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 commented 2 years ago

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

bensaxophone commented 2 years ago

@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 commented 2 years ago

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