Fri, 05/25/2018 - 16:32
Usecase: I intend to use the OpenCascade C++ library in my C++ project. I need to do simple polyline offsetting and polygon scaling down.
So I am attempting to install the OpenCascade C++ library on my Windows 10 64bit machine to use in Visual Studio 17. My first attempt was to use the windows installer then run the batch files (env.bat, custom.bat). But I have read on this forum that the windows installer wont work for Visual Studio 2017 - is that correct?
So I have now followed the build instructions here. And now I have opened the sample projects in Visual Studio 2017. When I try to build the project I get the following errors for each of the sample projects:
Error MSB8036 The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". TKQADraw C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\v141\Toolset.targets 36
Any advice on what I have done wrong? Maybe I didn't build it properly following these steps? Also, given my usecase above, do I need to do all this if I just want to use OpenCascade in a limited way?
Is there documentation or a link on how I create a new Visual Studio C++ project and link all the OpenCascade libraries?
Sun, 07/22/2018 - 00:26
What I have done is the following.
1. Open the "Developer Command Prompt for VS2017"
2. cd C:\OpenCASCADE-7.3.0-vc10-64\opencascade-7.3.0\samples\mfc\standard
3. env.bat
4. start VS2017 by issuing the command
devenv
5. Open the solution file
All-vc141.sln
6. Rebuild the solution
I managed to compile the samples this way. I was trying to figure out what VS settings I need to start compiling the examples in the opencascade tutorial. I have still not figured out how to do this successfully.
Best regards,
John Bijnens
Sun, 07/22/2018 - 20:51
> OpenCASCADE-7.3.0-vc10-64
Either, you should install compatible build, or build OCCT from source code.
VS2010 (installed) and VS2017 (used) are incompatible - you should download another OCCT build.
Sun, 07/22/2018 - 21:08
Hi,
You are absolutely right. I forget to change the number in the path.
For my current use I'm using VS 2015 and I copied the path from there, hence the vc10.
I have build OCCT from source again to have the necessary lib files for vc14.
Meanwhile I'm able to compile the examples. The thing I overlooked were the lib files which have to be added as additional dependencies for the linker. It seems static linking is what is expected by default.
I have a written a short report of what I have done to get it working. I did this so I could remember what I have done. It is attached to this post. All comments and remarks to improve it are welcomed.
Wed, 04/08/2020 - 07:33
Hello John Bijnens
Since you have solved the problem already. Here is what I am facing: I am trying to build https://github.com/lvk88/OccTutorial. However, I am getting a linker error. I have already added lib folder containing TKernel TKMath TKPrim TKBO TKSTEP lib files. Using VS 2019 and opencascade-7.4.0.
I am getting the following error during build:
1>------ Build started: Project: CppCLR_WinformsProjekt3, Configuration: Debug x64 ------
1>AssemblyInfo.obj : MSIL module encountered; incremental linking is disabled for MSIL; performing full link
1> Creating library C:\Users\jmudi\source\repos\CppCLR_WinformsProjekt3\x64\Debug\CppCLR_WinformsProjekt3.lib and object C:\Users\jmudi\source\repos\CppCLR_WinformsProjekt3\x64\Debug\CppCLR_WinformsProjekt3.exp
1>Source.obj : error LNK2028: unresolved token (0A0008FE) "public: class gp_Mat __cdecl GProp_GProps::MatrixOfInertia(void)const " (?MatrixOfInertia@GProp_GProps@@$$FQEBA?AVgp_Mat@@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2028: unresolved token (0A0008FF) "public: class gp_Pnt __cdecl GProp_GProps::CentreOfMass(void)const " (?CentreOfMass@GProp_GProps@@$$FQEBA?AVgp_Pnt@@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2028: unresolved token (0A000900) "public: double __cdecl GProp_GProps::Mass(void)const " (?Mass@GProp_GProps@@$$FQEBANXZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2028: unresolved token (0A000902) "public: static void __cdecl BRepGProp::VolumeProperties(class TopoDS_Shape const &,class GProp_GProps &,bool,bool,bool)" (?VolumeProperties@BRepGProp@@$$FSAXAEBVTopoDS_Shape@@AEAVGProp_GProps@@_N22@Z) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2028: unresolved token (0A000903) "public: __cdecl GProp_GProps::GProp_GProps(void)" (??0GProp_GProps@@$$FQEAA@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2028: unresolved token (0A00090A) "public: virtual class TopoDS_Shape const & __cdecl BRepBuilderAPI_MakeShape::Shape(void)" (?Shape@BRepBuilderAPI_MakeShape@@$$FUEAAAEBVTopoDS_Shape@@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2028: unresolved token (0A000939) "public: virtual __cdecl BRepBuilderAPI_Command::~BRepBuilderAPI_Command(void)" (??1BRepBuilderAPI_Command@@$$FUEAA@XZ) referenced in function "public: virtual __cdecl BRepBuilderAPI_MakeShape::~BRepBuilderAPI_MakeShape(void)" (??1BRepBuilderAPI_MakeShape@@$$FUEAA@XZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl BRepBuilderAPI_Command::~BRepBuilderAPI_Command(void)" (??1BRepBuilderAPI_Command@@$$FUEAA@XZ) referenced in function "public: virtual __cdecl BRepBuilderAPI_MakeShape::~BRepBuilderAPI_MakeShape(void)" (??1BRepBuilderAPI_MakeShape@@$$FUEAA@XZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual class TopoDS_Shape const & __cdecl BRepBuilderAPI_MakeShape::Shape(void)" (?Shape@BRepBuilderAPI_MakeShape@@$$FUEAAAEBVTopoDS_Shape@@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl GProp_GProps::GProp_GProps(void)" (??0GProp_GProps@@$$FQEAA@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: static void __cdecl BRepGProp::VolumeProperties(class TopoDS_Shape const &,class GProp_GProps &,bool,bool,bool)" (?VolumeProperties@BRepGProp@@$$FSAXAEBVTopoDS_Shape@@AEAVGProp_GProps@@_N22@Z) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: double __cdecl GProp_GProps::Mass(void)const " (?Mass@GProp_GProps@@$$FQEBANXZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: class gp_Pnt __cdecl GProp_GProps::CentreOfMass(void)const " (?CentreOfMass@GProp_GProps@@$$FQEBA?AVgp_Pnt@@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: class gp_Mat __cdecl GProp_GProps::MatrixOfInertia(void)const " (?MatrixOfInertia@GProp_GProps@@$$FQEBA?AVgp_Mat@@XZ) referenced in function "int __cdecl cxmain(void)" (?cxmain@@$$FYAHXZ)
1>C:\Users\jmudi\source\repos\CppCLR_WinformsProjekt3\x64\Debug\CppCLR_WinformsProjekt3.exe : fatal error LNK1120: 14 unresolved externals
1>Done building project "CppCLR_WinformsProjekt3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========