4
votes

This has been a common problem on forums but solutions elude me. Windows 10 64 bit, CGAL 4.11, Cmake 3.9.2, Boost 1.65.1, Qt5 for MSVS 2017, libQGLViewer 2.7.0, Visual Studio 2017, CGAL built both as Debug and Release, myriad C++ include paths and Windows user path variables tried. Same thing that it can't open, not necessarily can't find, a main CGAL library file. The .lib file certainly exists. When I try to run a simple CGAL test program, I can't get past this error.

https://imgur.com/gallery/heEDb

1
Potential answer here, that CGAL has been built with a wrong linker flag, but I don't see in CMake after Configure any line specifying /MTd whereas I see plenty for /MD and /MDd, so this is not really the problem. stackoverflow.com/a/28044353/4806365NikNYC
Adding /VERBOSE to the project's Linker properties additional entries gives no additional info, it's just lists all the includes up to the error.NikNYC
If instead of just add the library location to C++ headers in right-click Properties, I add it to Linker additional library directories, it compiles (Debug mode) and an ouput window appears finally, but then won't run since it says "CGAL-vc140-mt-dg-4.11.dll is missing" which does exist actually and my C++ header entries do point to its directory. I got lots of other PDB file errors before this final error, but they are gone after I turn on Tools>Options>Debugging>Symbols>Microsoft Symbol Servers.NikNYC
Indeed, the non-graphic geometry test programs for CGAL are working fine, from here, now that I have added the .dll to my program directory: doc.cgal.org/latest/Manual/tutorial_hello_world.html. I can also use CMake and then compile and run the installed CGAL examples, if I copy the .dll into the root directory I build it into, so CGAL itself is not broken.NikNYC
Have a look here to see if you missed any step. In particular the setting of environment variables.sloriot

1 Answers

3
votes

Indeed, I had to activate Windows 10 built-in Bash shell, in two easy-to-Google steps, then simply copy cgal_create_CMakeLists from the CGAL scripts directory to my Visual Studio project directory and get into Windows disks through the Bash "mnt" directory. When I just typed "cgal_create_CMakeLists" it spit out info on how to install the script via a command and then, after much churning, when I just typed "cgal_create_CMakeLists" it added a CMakeLists file and I merely had to point CMake-gui to the unfound Boost_DIR install directory to let Configure not list red errors. Then Visual Studio could open the .sln file that was created by CMake-gui, and it compiled. Right click assigning my program listing in the Solution Explorer pane to Set as StartUp Project let me hit the green debugger arrow and after a blank console window disappeared, CGAL wrote a nice ASCII tetrahedral out.Mesh file. Initially, the example file I used was copied from the CGEN reference site and pasted into a fresh Visual Studio Windows Console project, of a spherical boundary tetrahedral mesh:

http://cgal-discuss.949826.n4.nabble.com/CGAL-demos-on-Windows-won-t-configure-td4656618.html

I'm not sure what software will now visualize the simply formatted .Mesh file, since MeshLab won't.

Three Demo packages are said to create their own graphics if you have QT5 and libQGLViewer: Polygon, Polyhedron and AABB_tree. I can at least have some chance in building them with Visual Studio, now that CMake is partnered with CGEN's little shell script Windows 10 is happy to run.

CGAL is vastly complicated to use at all until you read the fine print about it being fundamentally reliant on a CMake preparation script for compiling even the simplest of examples.