How to compile VTK 8.2.0 with gcc-7 and Qt 5.9.1 on MacOS 10.14?

@dgobbi
Thanks again for your useful advice! Using otool, I indeed found out that there were library discrepancies. The VTK lib, which I compiled with clang is linked against libc++ whereas the CylinderExample, which I compiled with gcc is linked against libstdc++. There is more information about it here including a description on how to use libc++ in a gcc compiled program.

This doesn’t yet explain why exactly the screen stays black, however, I successfully ran the example compiled with gcc and with a working visualization when adding the corresponding compiler flag and include path by adding these two lines to the pro file:

QMAKE_CXXFLAGS += -nostdinc++
INCLUDEPATH += /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1

I will now have to check though whether I am able to use libc++ in our project since there are some other libraries linked, which might link to libstdc++ as well. Also, a first attempt to compile our project with the additional flags produced compile errors with calls to e.g. std::atan2:

In file included from ../../implementation/library/source/linear_algebra_library/coordinate_vector.h:8:0,
                 from ../library/source/general_structs/general_structs.h:4,
                 from ../library/source/general_structs/general_structs.cpp:1:
../../implementation/library/source/linear_algebra_library/coordinate_vector_array.h: In member function 'CoordinateVectorArray<ValueType, MaxSize> CoordinateVectorArray<ValueType, MaxSize>::cartesianToPolar() const':
../../implementation/library/source/linear_algebra_library/coordinate_vector_array.h:611:33: error: 'atan2' is not a member of 'std'
     polarCoords.mData[1] = std::atan2(mData[1], mData[0]);
                                 ^~~~~
../../implementation/library/source/linear_algebra_library/coordinate_vector_array.h:611:33: note: suggested alternative:
In file included from ../../implementation/library/source/linear_algebra_library/coordinate_vector_array.h:4:0,
                 from ../../implementation/library/source/linear_algebra_library/coordinate_vector.h:8,
                 from ../library/source/general_structs/general_structs.h:4,
                 from ../library/source/general_structs/general_structs.cpp:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:823:1: note:   'atan2'
 atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
 ^~~~~

Instead, I might need to figure out how to compile VTK with clang, but link against libstdc++, if that is actually possible.

Remaining question for me is, which library (libc++ or libstdc++) is more preferable anyways especially regarding compatibility to other libraries and other target systems.

Thanks so far!