Important: Please read the Qt Code of Conduct -

Qt Creator and SystemC libraries - 'undefined reference' errors

  • Hello. I have a problem with a C++ project which uses some SystemC libraries (however, this project can be built correctly using MS Visual Studio). While trying to build a project, I get tons of 'undefined reference' errors like:

    /home/user111/Desktop/systemc-2.3.2/src/sysc/communication/sc_port.h:465: error: undefined reference to `sc_core::sc_abort()'

    Path (/home/user111/.../src) is included using INCLUDEPATH += in .pro file.
    My OS is Linux Mint 18.
    What can I do with it?

  • Lifetime Qt Champion


    Are you linking your project to that library ?

  • @SGaist Yes, I am linking my project to that library.

  • Lifetime Qt Champion

    Can you show the .pro file ?

    Did you check that the library was from the correct architecture ?

  • @SGaist , this is my .pro file:

    TEMPLATE = app
    CONFIG += console c++11
    CONFIG -= app_bundle
    CONFIG -= qt
    SOURCES += \
        ../myproject/ImpulseGen.cpp \
        ../myproject/ImpulseGenTest.cpp \
    HEADERS += \
        ../myproject/ImpulseGen.h \
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Desktop/systemc-2.3.2/lib-linux/release/ -lsystemc
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Desktop/systemc-2.3.2/lib-linux/debug/ -lsystemc
    else:unix: LIBS += -L$$PWD/../Desktop/systemc-2.3.2/lib-linux/ -lsystemc
    INCLUDEPATH += $$PWD/../Desktop/systemc-2.3.2/include
    DEPENDPATH += $$PWD/../Desktop/systemc-2.3.2/include
    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../Desktop/systemc-2.3.2/lib-linux/release/libsystemc.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../Desktop/systemc-2.3.2/lib-linux/debug/libsystemc.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../Desktop/systemc-2.3.2/lib-linux/release/systemc.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../Desktop/systemc-2.3.2/lib-linux/debug/systemc.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../Desktop/systemc-2.3.2/lib-linux/libsystemc.a

    After my first message, I re-built systemc libraries () and included them in my project, but one error still occurs:

    /home/user111/Desktop/systemc-2.3.2/include/sysc/kernel/sc_ver.h:179: error: undefined reference to `sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)'

    This error is in "include/sysc/kernel/sc_ver.h" file:

    api_version_check  // error here

  • Lifetime Qt Champion

    From the looks of it I would say there's somehow a mismatch with the C++ standard used and this stackoverflow answer goes in the same direction.

Log in to reply