Important: Please read the Qt Code of Conduct -

LNK2019 : Unresolved External Symbols referenced in function_main

  • Please help me with a problem I've been facing

    I have been trying to add a library into my project. My project file looks like this :

    QT += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = sdk2
    TEMPLATE = app
    SOURCES += main.cpp\
    HEADERS += mainwindow.h \
    ../../../../../SDKstudy/Runtime5.1/include/fgrab_struct.h \
    ../../../../../SDKstudy/Runtime5.1/include/fgrab_prototyp.h \
    INCLUDEPATH += $$PWD/../../../../../SDKstudy/Runtime5.1\include
    DEPENDPATH += $$PWD/../../../../../SDKstudy/Runtime5.1\include
    INCLUDEPATH += C:\Users\Alok\SDKstudy\Runtime5.1\dll\mE4AD1-CL
    DEPENDPATH += C:\Users\Alok\SDKstudy\Runtime5.1\dll\mE4AD1-CL
    FORMS += mainwindow.ui
    LIBS += -L$$PWD/../../../../../SDKstudy/Runtime5.1/lib/visualc2005_amd64/ -lfglib5
    INCLUDEPATH += $$PWD/../../../../../SDKstudy/Runtime5.1/lib/visualc2005_amd64
    DEPENDPATH += $$PWD/../../../../../SDKstudy/Runtime5.1/lib/visualc2005_amd64


    When i try to run the code i get the following error

    main.obj:-1: error: LNK2019: unresolved external symbol _Fg_Init referenced in function _main

    Can you please help me resolve this

    Many thanks

  • looks like the lib you link to (fglib5) did not export that symbol. Are you sure its supposed to be used by your app?

  • Hi Thomas

    pardon me..but i did not understand by what you meant by "did not export that symbol". fglib5 is a 3rd party library very crucial for my project, and I have been unable to link it yet.

  • I see.. thanks for the link.

    What is the way out then?

  • my compilation output is this, in case it helps

    @16:29:46: Running steps for project sdk2...
    16:29:46: Starting: "C:\Users\Alok\Qt5.0.0beta2\5.0.0-beta2\msvc2010\bin\qmake.exe" "C:\Users\Alok\Qt5.0.0beta2\Tools\Qt Creator\bin\sdk2\" -r -spec win32-msvc2010 "CONFIG+=debug" "CONFIG+=qml_debug"
    16:29:47: The process "C:\Users\Alok\Qt5.0.0beta2\5.0.0-beta2\msvc2010\bin\qmake.exe" exited normally.
    16:29:47: Starting: "C:\Users\Alok\Qt5.0.0beta2\Tools\Qt Creator\bin\jom.exe"
    "C:\Users\Alok\Qt5.0.0beta2\Tools\Qt Creator\bin\jom.exe" -f Makefile.Debug
    echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID / 24 / RT_MANIFEST / "debug\sdk2.exe.embed.manifest">debug\sdk2.exe_manifest.rc
    if not exist debug\sdk2.exe del debug\sdk2.exe.embed.manifest>NUL 2>&1
    if exist debug\sdk2.exe.embed.manifest copy /Y debug\sdk2.exe.embed.manifest debug\sdk2.exe_manifest.bak
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='' publicKeyToken='6595b64144ccf1df' language='
    ' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\sdk2.exe.embed.manifest /OUT:debug\sdk2.exe @C:\Users\Alok\AppData\Local\Temp\sdk2.exe.1200.0.jom
    main.obj : error LNK2019: unresolved external symbol _Fg_Init referenced in function _main
    debug\sdk2.exe : fatal error LNK1120: 1 unresolved externals
    jom: C:\Users\Alok\Qt5.0.0beta2\Tools\Qt Creator\bin\sdk2-build-Desktop_Qt_5_0_0_beta2_MSVC2010_32bit_SDK-Debug\Makefile.Debug [debug\sdk2.exe] Error 1120
    jom: C:\Users\Alok\Qt5.0.0beta2\Tools\Qt Creator\bin\sdk2-build-Desktop_Qt_5_0_0_beta2_MSVC2010_32bit_SDK-Debug\Makefile [debug] Error 2
    16:29:47: The process "C:\Users\Alok\Qt5.0.0beta2\Tools\Qt Creator\bin\jom.exe" exited with code 2.
    Error while building/deploying project sdk2 (target: Desktop Qt 5.0.0 beta2 MSVC2010 32bit (SDK))
    When executing step 'Make'

Log in to reply