PDA

View Full Version : Problem including library (dllimport)



cae
27th May 2010, 10:16
Hi, im trying to use some libraries for ip camera control but it fails at compilation...

I include for example this file


#include <CyDeviceFinder.h>

and i include at the .pro:


INCLUDEPATH += "C:\Archivos de programa\JAI A-S\Cam2Net\Includes"
LIBS += -L"C:\Archivos de programa\JAI A-S\Cam2Net\Binaries" \
-lCyCamLib

and i get this error:


function 'CyResult CyParameterRepository::SetParameterByIndex(long unsigned int,char,bool)' definition is marked dllimport
.
.
.
.
with many functions

i've tried to remove LIBS...


INCLUDEPATH += "C:\Archivos de programa\JAI A-S\Cam2Net\Includes"

but it still fails...

it also throws some warnings:


ignoring #pragma warning

I've googled this problem but i havent found any solution, in some threads said that the cpp compiler wasnt correct, others to include a #define CLASSNAME_EXPORTS .... but...

Can anybody help me?

tbscope
27th May 2010, 10:39
I've googled this problem but i havent found any solution, in some threads said that the cpp compiler wasnt correct, others to include a #define CLASSNAME_EXPORTS .... but...

But what?
Check the .h file to find the correct define

cae
27th May 2010, 10:45
The class including <CyDeviceFinder.h> is ImageComposer

I wrote on imagecomposer.h , and also tried on imagecomposer.cpp but didnt work.

#define IMAGECOMPOSER_EXPORTS
#include <CyDeviceFinder.h>

tbscope
27th May 2010, 10:50
Ahh, you got it wrong.
Look in CyDeviceFinder.h and see what you need to define to get the exports and not the imports

cae
27th May 2010, 10:54
Ok sorry, ill write here all the code:

main.cpp

#include <QtCore/QCoreApplication>
#include "imagecomposer.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Imagecomposer compo;
return a.exec();
}


Imagecomposer.h

#ifndef IMAGECOMPOSER_H
#define IMAGECOMPOSER_H
#define IMAGECOMPOSER_EXPORTS
#include <CyDeviceFinder.h>
class Imagecomposer
{
public:
Imagecomposer();
};

#endif // IMAGECOMPOSER_H



#include "imagecomposer.h"

Imagecomposer::Imagecomposer()
{
}

Imagecomposer.cpp

#include "imagecomposer.h"
Imagecomposer::Imagecomposer()
{
}

ImageJAI.pro


# -------------------------------------------------
# Project created by QtCreator 2010-05-27T11:47:58
# -------------------------------------------------
TARGET = ImageJAI
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
imagecomposer.cpp
LIBS += -LC:\qextserialport\build \
-lqextserialport
INCLUDEPATH += "C:\Archivos de programa\JAI A-S\Cam2Net\Includes"
HEADERS += imagecomposer.h


EDIT: SORRY i wrote while you answered!!!!

tbscope
27th May 2010, 10:58
This is a quess. Without seeing the CyDeviceFinder.h include file I can't be sure.
But try this: #define CYDEVICEFINDER_EXPORTS instead of #define IMAGECOMPOSER_EXPORTS

Now, in reality it might be named differently, check CyDeviceFinder.h

cae
27th May 2010, 11:09
It didnt work :(

Despite the include I wrote is for CyDeviceFinder.h , the error seems to come from another file..

I include DeviceFinder, but that ones includes CyConfig, that one CyPersistentRepository and at last CyParameterRepository

I tried to write the define line in CyPersistentRepository like

#define CYPERSISTENTREPOSITORY_EXPORTS
and also
#define CYPARAMETERREPOSITORY_EXPORTS

but still doesnt work.... :(

tbscope
27th May 2010, 11:44
I have no idea then.
Did you check the documentation of the library you're using?

cae
27th May 2010, 12:09
Yes, i checked, they use Visual Studio to make it work.... could it have something to do with this problem?

cae
28th May 2010, 06:53
I'm trying now with Visual Studio Express and it seems to work, how is it possible that it works on VS and not in QT, arent the libraries independent from the Development environment?