Skip to content

Cannot add Open3D to simple Qt5 app #6334

@crosswick

Description

@crosswick

Checklist

Steps to reproduce the issue

I first cloned Open3D by:

git clone https://github.com/isl-org/Open3D.git
cd Open3D

Then, I built Open3D (on macOS 12.6.7) with:

mkdir build
cd build
cmake -DBUILD_PYTHON_MODULE=OFF ..
make -j$(sysctl -n hw.physicalcpu)

This gave errors, leading me to comment out a bunch of unused variables in Feature.cpp, see #6268

then make install

then build this simple cmake Qt5 example:

git clone https://github.com/ArthurSonzogni/cmake-Qt5-example.git
cd cmake-Qt5-example/
mkdir build
cd build
cmake ..
make
./myApplication

which succesfully runs this simple app.

Then, adding Open3D to this the CMakeLists.txt of this app:

# ┌──────────────────────────────────────────────────────────────────┐
# │  Open3D                                                          │
# └──────────────────────────────────────────────────────────────────┘

find_package(Open3D REQUIRED)
if (Open3D_FOUND)
    message(STATUS "Found Open3D ${Open3D_VERSION}")

    # Link directories
    link_directories(${Open3D_LIBRARY_DIRS})

    # Include directories
    include_directories(${Open3D_INCLUDE_DIRS})

else (Open3D_FOUND)
    message(STATUS "Open3D not found, skipping...")
endif (Open3D_FOUND)

Error message

In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:25:73: error: expected '(' for function-style cast or type construction
inline constexpr bool qIsRelocatable =  std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>;
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/include/QtCore/qtypeinfo.h:25:81: error: no template named 'is_trivially_destructible_v' in namespace 'std'; did you mean 'is_trivially_destructible'?
inline constexpr bool qIsRelocatable =  std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>;
                                                                           ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:3411:50: note: 'is_trivially_destructible' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
                                                 ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:25:111: error: expected '(' for function-style cast or type construction
inline constexpr bool qIsRelocatable =  std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>;
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/QtCore/qtypeinfo.h:35:14: error: no template named 'is_scalar_v' in namespace 'std'; did you mean 'is_scalar'?
        std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>;
        ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:1198:29: note: 'is_scalar' declared here
struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { };
                            ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:35:29: error: expected '(' for function-style cast or type construction
        std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>;
        ~~~~~~~~~~~~~~~~~~~ ^
/usr/local/include/QtCore/qtypeinfo.h:35:38: error: no template named 'is_member_object_pointer_v' in namespace 'std'; did you mean 'is_member_object_pointer'?
        std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>;
                                ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:1092:29: note: 'is_member_object_pointer' declared here
struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
                            ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:35:67: error: expected '(' for function-style cast or type construction
        std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>;
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/QtCore/qtypeinfo.h:48:26: error: no template named 'is_pointer_v' in namespace 'std'; did you mean 'is_pointer'?
        isPointer = std::is_pointer_v<T>,
                    ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:872:29: note: 'is_pointer' declared here
struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { };
                            ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:48:41: error: expected '(' for function-style cast or type construction
        isPointer = std::is_pointer_v<T>,
                    ~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/QtCore/qtypeinfo.h:49:27: error: no template named 'is_integral_v' in namespace 'std'; did you mean 'is_integral'?
        isIntegral = std::is_integral_v<T>,
                     ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:772:29: note: 'is_integral' declared here
struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { };
                            ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:49:43: error: expected '(' for function-style cast or type construction
        isIntegral = std::is_integral_v<T>,
                     ~~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/QtCore/qtypeinfo.h:50:27: error: no template named 'is_trivial_v' in namespace 'std'; did you mean 'is_trivial'?
        isComplex = !std::is_trivial_v<T>,
                     ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:3728:50: note: 'is_trivial' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
                                                 ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:50:42: error: expected '(' for function-style cast or type construction
        isComplex = !std::is_trivial_v<T>,
                     ~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/QtCore/qtypeinfo.h:169:1: error: no template named 'is_trivial_v' in namespace 'std'; did you mean 'is_trivial'?
Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/QtCore/qtypeinfo.h:154:66: note: expanded from macro 'Q_DECLARE_TYPEINFO_BODY'
        isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v<TYPE>, \
                                                            ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:3728:50: note: 'is_trivial' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
                                                 ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:169:1: error: expected '(' for function-style cast or type construction
Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/QtCore/qtypeinfo.h:154:84: note: expanded from macro 'Q_DECLARE_TYPEINFO_BODY'
        isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v<TYPE>, \
                                                            ~~~~~~~~~~~~~~~~~~~~~~~^
/usr/local/include/QtCore/qtypeinfo.h:169:1: error: no template named 'is_pointer_v' in namespace 'std'; did you mean 'is_pointer'?
Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/QtCore/qtypeinfo.h:156:26: note: expanded from macro 'Q_DECLARE_TYPEINFO_BODY'
        isPointer = std::is_pointer_v< TYPE >, \
                    ~~~~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/type_traits:872:29: note: 'is_pointer' declared here
struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { };
                            ^
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/mocs_compilation.cpp:2:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/moc_MainWindow.cpp:10:
In file included from /Users/steven/cmake-Qt5-example/build/myApplication_autogen/2TYNM7PALD/../../../src/interface/MainWindow.hpp:4:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt@5/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /usr/local/include/QtWidgets/qtwidgetsglobal.h:7:
In file included from /usr/local/include/QtGui/qtguiglobal.h:7:
In file included from /usr/local/include/QtCore/qglobal.h:46:
/usr/local/include/QtCore/qtypeinfo.h:169:1: error: expected '(' for function-style cast or type construction
Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/QtCore/qtypeinfo.h:156:46: note: expanded from macro 'Q_DECLARE_TYPEINFO_BODY'
        isPointer = std::is_pointer_v< TYPE >, \
                    ~~~~~~~~~~~~~~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Open3D, Python and System information

- Operating system: macOS 12.6.7 
- Open3D version: 0.17.0+59792c226
- System architecture: x86 
- Is this a remote workstation?: no
- How did you install Open3D?: build from source
- Compiler version (if built from source): AppleClang 14.0.0.14000029

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    build/installBuild or installation issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions