Results 1 to 10 of 10

Thread: Problem including library (dllimport)

  1. #1
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem including library (dllimport)

    Hi, im trying to use some libraries for ip camera control but it fails at compilation...

    I include for example this file
    Qt Code:
    1. #include <CyDeviceFinder.h>
    To copy to clipboard, switch view to plain text mode 

    and i include at the .pro:
    Qt Code:
    1. INCLUDEPATH += "C:\Archivos de programa\JAI A-S\Cam2Net\Includes"
    2. LIBS += -L"C:\Archivos de programa\JAI A-S\Cam2Net\Binaries" \
    3. -lCyCamLib
    To copy to clipboard, switch view to plain text mode 

    and i get this error:
    Qt Code:
    1. function 'CyResult CyParameterRepository::SetParameterByIndex(long unsigned int,char,bool)' definition is marked dllimport
    2. .
    3. .
    4. .
    5. .
    6. with many functions
    To copy to clipboard, switch view to plain text mode 

    i've tried to remove LIBS...

    Qt Code:
    1. INCLUDEPATH += "C:\Archivos de programa\JAI A-S\Cam2Net\Includes"
    To copy to clipboard, switch view to plain text mode 

    but it still fails...

    it also throws some warnings:

    Qt Code:
    1. ignoring #pragma warning
    To copy to clipboard, switch view to plain text mode 

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Problem including library (dllimport)

    Quote Originally Posted by cae View Post
    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

  3. #3
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem including library (dllimport)

    The class including <CyDeviceFinder.h> is ImageComposer

    I wrote on imagecomposer.h , and also tried on imagecomposer.cpp but didnt work.
    Qt Code:
    1. #define IMAGECOMPOSER_EXPORTS
    2. #include <CyDeviceFinder.h>
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Problem including library (dllimport)

    Ahh, you got it wrong.
    Look in CyDeviceFinder.h and see what you need to define to get the exports and not the imports

  5. #5
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem including library (dllimport)

    Ok sorry, ill write here all the code:

    main.cpp
    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include "imagecomposer.h"
    3. int main(int argc, char *argv[])
    4. {
    5. QCoreApplication a(argc, argv);
    6. Imagecomposer compo;
    7. return a.exec();
    8. }
    To copy to clipboard, switch view to plain text mode 

    Imagecomposer.h
    Qt Code:
    1. #ifndef IMAGECOMPOSER_H
    2. #define IMAGECOMPOSER_H
    3. #define IMAGECOMPOSER_EXPORTS
    4. #include <CyDeviceFinder.h>
    5. class Imagecomposer
    6. {
    7. public:
    8. Imagecomposer();
    9. };
    10.  
    11. #endif // IMAGECOMPOSER_H
    12.  
    13.  
    14.  
    15. #include "imagecomposer.h"
    16.  
    17. Imagecomposer::Imagecomposer()
    18. {
    19. }
    To copy to clipboard, switch view to plain text mode 

    Imagecomposer.cpp
    Qt Code:
    1. #include "imagecomposer.h"
    2. Imagecomposer::Imagecomposer()
    3. {
    4. }
    To copy to clipboard, switch view to plain text mode 

    ImageJAI.pro
    Qt Code:
    1. # -------------------------------------------------
    2. # Project created by QtCreator 2010-05-27T11:47:58
    3. # -------------------------------------------------
    4. TARGET = ImageJAI
    5. CONFIG += console
    6. CONFIG -= app_bundle
    7. TEMPLATE = app
    8. SOURCES += main.cpp \
    9. imagecomposer.cpp
    10. LIBS += -LC:\qextserialport\build \
    11. -lqextserialport
    12. INCLUDEPATH += "C:\Archivos de programa\JAI A-S\Cam2Net\Includes"
    13. HEADERS += imagecomposer.h
    To copy to clipboard, switch view to plain text mode 


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

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Problem including library (dllimport)

    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

  7. #7
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem including library (dllimport)

    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....

  8. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Problem including library (dllimport)

    I have no idea then.
    Did you check the documentation of the library you're using?

  9. #9
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem including library (dllimport)

    Yes, i checked, they use Visual Studio to make it work.... could it have something to do with this problem?

  10. #10
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem including library (dllimport)

    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?

Similar Threads

  1. Problem of including Widgets into DLL
    By dsedov in forum Qt Programming
    Replies: 15
    Last Post: 15th July 2021, 00:05
  2. Problem with including lib files
    By metow in forum Qt Tools
    Replies: 2
    Last Post: 12th December 2009, 22:57
  3. Replies: 5
    Last Post: 19th November 2008, 18:54
  4. Replies: 3
    Last Post: 10th May 2008, 18:36
  5. Algorithms problem of brackets including.
    By luffy27 in forum General Programming
    Replies: 2
    Last Post: 12th April 2007, 02:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.