SoftingIndustrial / OPC-Classic-SDK

Softing OPC Classic SDK
https://industrial.softing.com/de/produkte/opc-ua-und-opc-classic-sdks.html
MIT License
55 stars 24 forks source link

OPCToolbox_VS2017.sln - LINK : fatal error LNK1104: cannot open file 'OTBD.lib' #3

Closed WaldemarCoding closed 3 years ago

WaldemarCoding commented 3 years ago

When I try to compile the OPCToolbox_VS2017.sln I get a Link Error for OTBD.lib file. I followed the _5._Compiling_the_OPC_Toolkitcore.md doc

I ran VS2019 16.11.2 in UserMode and AdminMode with the same result

1>Generating Code...
1>   Creating library .\bin\VS2017\Win32\Debug\OTBD.lib and object .\bin\VS2017\Win32\Debug\OTBD.exp
1>OTB_VS2017.vcxproj -> C:\Users\PC183\Desktop\OPC-Classic-SDK\development\core\src\OTB\bin\VS2017\Win32\Debug\OTBD.dll
1>        1 Datei(en) kopiert.
1>        1 Datei(en) kopiert.
1>Done building project "OTB_VS2017.vcxproj".
2>------ Build started: Project: OPCToolboxC++_VS2017, Configuration: Debug Win32 ------
2>LINK : fatal error LNK1104: cannot open file 'OTBD.lib'
2>Done building project "OPCToolboxC++_VS2017.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
mrsuciu commented 3 years ago

The VS2019 version seems to have changed somehow the behavior of the PostBuild copy event. Try the following:

  1. Compile the OTB_VS2017 project
  2. Manually create a folder called "lib" under "\development\core" and copy the "\development\core\src\OTB\bin\VS2017\Win32\Debug\OTBD.lib" to it.
  3. Compile the OPCToolboxC++_VS2017 project
FischerSeb commented 3 years ago

@WaldemarCoding If you can solve the issue please feel free to make a PR

WaldemarCoding commented 3 years ago

Manually copying the file works. I also was able to solve it by switching to xcopy. Source: StackOverflow

The PostBuild of OTB now looks like this

xcopy "$(TargetPath)" "..\..\..\bin\" /F /R /Y /I
xcopy "$(TargetDir)$(TargetName).lib" "..\..\lib\" /F /R /Y /I

instead of

copy "$(TargetPath)" ..\..\..\bin
copy "$(TargetDir)\$(TargetName).lib" ..\..\lib

Also notice that I removed the extra backslash between TargetDir and TargetName, as TargetName already contains the backslash and added quotes around the Destination.

@FischerSeb For the PR I would add VS2019 Versions of Projects and Solution:

FischerSeb commented 3 years ago

VS2019 support is perfect. Please add the 5 files to the gitignore file.

Eta76 commented 2 years ago

Maybe you make a new release or tag? So someone can easily download the correct version. Current release is from April.

Latest Main branch 2>------ Build started: Project: OPCToolboxC++_VS2019, Configuration: Debug x64 ------ 2>LINK : fatal error LNK1104: cannot open file 'OTBx64.lib'