PDA

View Full Version : Lnk 2019



alok9871
28th January 2013, 10:13
Hi friends

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\
mainwindow.cpp

HEADERS += mainwindow.h \
../../../../../SDKstudy/Runtime5.1/include/fgrab_struct.h \
../../../../../SDKstudy/Runtime5.1/include/fgrab_prototyp.h \
../../../../../SDKstudy/Runtime5.1/include/fgrab_define.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

Regards
Alok

Lykurg
28th January 2013, 10:23
Are you sure $PWD is pointing to the right directory so that the "../../../" are right? Try to use absolute paths to see if the error still remains.

alok9871
28th January 2013, 10:35
Hi Lykurg

I tried using absolute path as well. The error persists still :(

Lykurg
28th January 2013, 19:29
Ok, why do you have e.g. "../../../../../SDKstudy/Runtime5.1/include/fgrab_struct.h" in the HEADERS variable? And how does your main function look like?

alok9871
29th January 2013, 02:46
what I did was right clicked on project and clicked on add existing libraries. These syntaxes gets written when we complete adding libraries.


My Main function looks like this :



#include "mainwindow.h"
#include <stdio.h>
#include <QApplication>

#include"fgrab_define.h"
#include "fgrab_prototyp.h"
#include "fgrab_struct.h"

using namespace std;

#define DLLNAME "DualAreaGray16.dll"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Fg_Struct *fg = NULL;

fg = Fg_Init(DLLNAME, PN_MICROENABLE4AD1CL ); //function defined in library

return a.exec();
}

sdsd
13th July 2016, 17:10
Hey how did you solve your problem ? I'm stuck on the same thing