Help compiling nglib onWin

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Post by sgrogan »

wmayer wrote:Here is the patch.
I think I'm close. VS couldn't find pthreadVC2_64.lib because it doesn't exist on my system. I made a copy of pthreadVC2.lib and renamed it. Then I have the following.

Code: Select all

1>------ Build started: Project: nglib, Configuration: Release(OCC) x64 ------
1>     Creating library C:\Users\Chris\GitHub\netgen-mesher-git\windows\nglib\x64\Release(OCC)\nglib.lib and object C:\Users\Chris\GitHub\netgen-mesher-git\windows\nglib\x64\Release(OCC)\nglib.exp
1>gzstream.obj : error LNK2001: unresolved external symbol gzread
1>gzstream.obj : error LNK2001: unresolved external symbol gzwrite
1>gzstream.obj : error LNK2001: unresolved external symbol gzclose
1>gzstream.obj : error LNK2001: unresolved external symbol gzopen
1>C:\Users\Chris\GitHub\netgen-mesher-git\windows\nglib\x64\Release(OCC)\nglib.dll : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
"fight the good fight"
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Help compiling nglib onWin

Post by wmayer »

You have to pass the zlib to the linker.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Post by sgrogan »

wmayer wrote:You have to pass the zlib to the linker.
In project properties, Linker>General tab I have added the directory containing zlib.lib to "Additional Library Directories" already.
"fight the good fight"
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Help compiling nglib onWin

Post by wmayer »

But you also have to add zlib.lib as additional dependency.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Post by sgrogan »

wmayer wrote:But you also have to add zlib.lib as additional dependency.
Duh! Thanks :)
add pthreadVC2_64, zlib, and occt7 to the additional dependencies and nglib builds.
Then compiling FreeCAD

Code: Select all

Error	2	error C2370: 'netgen::multithread' : redefinition; different storage class	C:\Users\Chris\GitHub\FreeCAD\src\3rdParty\salomesmesh\src\NETGENPlugin\NETGENPlugin_Mesher.cpp	93	1	NETGENPlugin
Error	4	error C2375: 'netgen::OCCSetLocalMeshSize' : redefinition; different linkage	C:\Users\Chris\GitHub\FreeCAD\src\3rdParty\salomesmesh\src\NETGENPlugin\NETGENPlugin_NETGEN_2D_ONLY.cpp	75	1	NETGENPlugin
Error	6	error C2370: 'netgen::multithread' : redefinition; different storage class	C:\Users\Chris\GitHub\FreeCAD\src\3rdParty\salomesmesh\src\NETGENPlugin\NETGENPlugin_NETGEN_3D.cpp	84	1	NETGENPlugin
Error	7	error LNK1181: cannot open input file '..\..\..\..\lib\Release\NETGENPlugin.lib'	C:\Users\Chris\GitHub\FreeCAD-build\src\Mod\MeshPart\App\LINK	MeshPart
Error	8	error LNK1181: cannot open input file '..\..\..\..\lib\Release\NETGENPlugin.lib'	C:\Users\Chris\GitHub\FreeCAD-build\src\Mod\Fem\App\LINK	Fem
Error	9	error LNK1181: cannot open input file '..\App\Release\MeshPart.lib'	C:\Users\Chris\GitHub\FreeCAD-build\src\Mod\MeshPart\Gui\LINK	MeshPartGui
Error	10	error LNK1181: cannot open input file '..\App\Release\Fem.lib'	C:\Users\Chris\GitHub\FreeCAD-build\src\Mod\Fem\Gui\LINK	FemGui
"fight the good fight"
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Post by sgrogan »

sgrogan wrote:Error 2 error C2370: 'netgen::multithread' : redefinition; different storage class C:\Users\Chris\GitHub\FreeCAD\src\3rdParty\salomesmesh\src\NETGENPlugin\NETGENPlugin_Mesher.cpp 93 1 NETGENPlugin
Ahh, I hadn't seen this git commit 356723f I need to try again.
"fight the good fight"
amartin7211
Posts: 1
Joined: Sat Jan 21, 2017 2:56 pm

Re: Help compiling nglib onWin

Post by amartin7211 »

I too am trying to compile FreeCAD on windows and have run into some errors with NETGENPlugin_Mesher.

Here is one error that is repeated dozens of times for me:

Code: Select all

Error	1	error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl netgen::Point<3>::Point<3>(double,double,double)" (__imp_??0?$Point@$02@netgen@@QEAA@NNN@Z) referenced in function "public: static void __cdecl NETGENPlugin_Mesher::AddIntVerticesInFaces(class netgen::OCCGeometry const &,class netgen::Mesh &,class std::vector<class SMDS_MeshNode const *,class std::allocator<class SMDS_MeshNode const *> > &,class NETGENPlugin_Internals &)" (?AddIntVerticesInFaces@NETGENPlugin_Mesher@@SAXAEBVOCCGeometry@netgen@@AEAVMesh@3@AEAV?$vector@PEBVSMDS_MeshNode@@V?$allocator@PEBVSMDS_MeshNode@@@std@@@std@@AEAVNETGENPlugin_Internals@@@Z)	R:\Coding\FreeCADBuild_w_Netgen\build\src\3rdParty\salomesmesh\NETGENPlugin_Mesher.obj	NETGENPlugin
Any chance you have made more progress on this topic?
User avatar
shaise
Posts: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: Help compiling nglib onWin

Post by shaise »

sgrogan wrote:Error 2 error C2370: 'netgen::multithread' : redefinition; different storage class C:\Users\Chris\GitHub\FreeCAD\src\3rdParty\salomesmesh\src\NETGENPlugin\NETGENPlugin_Mesher.cpp 95 1 NETGENPlugin
Sgrogan,
Did you solve it? have the same issue.
shai
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Post by sgrogan »

shaise wrote:Did you solve it? have the same issue.
Not yet. blacey gave me a patch for ng 5.3.1, but I'm am trying to upgrade OCCT to 7.1 first so I don't have to do it twice. For now we still need to disable BUILD_FEM_NETGEN with CMake.
"fight the good fight"
Post Reply