[vtkusers] Build VTK with MinGW

Berti Krüger berti_krueger at hotmail.com
Wed Sep 12 01:47:25 EDT 2018

Am Di, 11. Sep, 2018 um 4:00 NACHMITTAGS schrieb tobias12345 <tobias.hofmann at itwm.fraunhofer.de>:

Hi Tobias.

I am not in any way an expert on vtk (still a vtk beginner myself) but from the compiler / linker errors you have posted, vtk seems to use the glew library internaly for enabling the opengl extensions in Windows and the linkage with the glew library seems not to be working correctly in your build environment.

This is often a problem when trying to link the glew library statically to a project without using the appropriate compiler flags. At least in linux the option -DGLEW_STATIC has to be added to the CXX_DEFINES so that glew gets linked statically in projects you want to be build statically.

So maybe you are trying to build vtk statically (.lib) and not dynamically (dlls) under mingw which results in the linker trying to link glew statically too but without the appropriate flags for glew to do so.

So one thing you could try is to build vtk dynamically or if you have done so, build it statically.

It could also be that you have to install the glew libraries manually first before building vtk (i don't know) or that they are already installed in another version in your mingw installation and that the linker gets confused in which version to take.

I am normally developing under linux but a short time ago, i had to compile a Windows version of one of my vtk projects and i had problems myself building vtk under Windows with mingw. What solved all of my problems was installing msys2 (https://www.msys2.org/), getting a linux-like environment under windows with all the necessesary tools (mingw, cmake, etc.) and just building everythink like in linux.

This still works like a charm and the executables produced with mingw in the msys2 environment are independent of msys2, have no external dependencies or whatsoever and can be used in every Windows installation.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180912/516aa32c/attachment.html>

More information about the vtkusers mailing list