Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

“jom.exe exited with code 2” when using headers outside of main.cpp



  • I have some trouble getting my application running. When I include the header files for a third-party api, the program throws the following error:
    3407e57c-0e86-4454-8cff-4258b7d23273-image.png

    This is my .pro file:

    QT += quick
    
    CONFIG += c++11
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    
    SOURCES += \
            db.cpp \
            main.cpp
    
    RESOURCES += qml.qrc
    
    QML_IMPORT_PATH =
    
    QML_DESIGNER_IMPORT_PATH =
    
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    HEADERS += \
        db.h
    
    INCLUDEPATH += C:/mongo-cxx-driver-3.4.1/include/bsoncxx/v_noabi \
                   C:/mongo-cxx-driver-3.4.1/include/mongocxx/v_noabi \
                   D:/boost_1_72_0
    
    LIBS += -LC:/mongo-cxx-driver-3.4.1/lib -lbsoncxx \
            -LC:/mongo-cxx-driver-3.4.1/lib -lmongocxx
    

    The code in the file types.hpp at line 39:

    enum class type : std::uint8_t {
    #define BSONCXX_ENUM(name, val) k_##name = val,
    #include <bsoncxx/enums/type.hpp>
    #undef BSONCXX_ENUM
    };
    

    The strange thing is that when I write the class in the main.cpp file, it works. The program also works fine in VS2019.


Log in to reply