Results 1 to 4 of 4

Thread: Mingw-32bit Vs MSVC2013-64bit Shared library issue

  1. #1
    Join Date
    May 2015
    Posts
    66
    Thanks
    10
    Thanked 17 Times in 17 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Mingw-32bit Vs MSVC2013-64bit Shared library issue

    Hello,

    I have a shared library that works perfectly with mingw-32bit compiler. On MSVC2013-64bit compiler however I get a strange problem.
    Qt Code:
    1. unresolved external symbol *__declspec(dllimport) .....
    To copy to clipboard, switch view to plain text mode 

    The problem is caused by a class in my shared library that is defined as:
    Qt Code:
    1. class TEST_IMPORT_EXPORT className { .... }
    To copy to clipboard, switch view to plain text mode 

    TEST_IMPORT_EXPORT is defined as :
    Qt Code:
    1. #ifdef BUILD_TEST_DLL
    2. #define TEST_IMPORT_EXPORT Q_DECL_EXPORT
    3. #else
    4. #define TEST_IMPORT_EXPORT Q_DECL_IMPORT
    5. #endif
    To copy to clipboard, switch view to plain text mode 

    I was wondering why the error says something about "dllImport" so I changed class definition to
    Qt Code:
    1. class Q_DECL_EXPORT className { .... }
    To copy to clipboard, switch view to plain text mode 
    and the MSVC2013-64bit works fine!

    But I for sure think its not the right way to fix this issue. Can someone provide me more info as to what might be going on here?!

    Thanks

    Regards
    Vikram

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Mingw-32bit Vs MSVC2013-64bit Shared library issue

    Have you checked that BUILD_TEST_DLL is set when you are building the library?

    Cheers,
    _

  3. #3
    Join Date
    May 2015
    Posts
    66
    Thanks
    10
    Thanked 17 Times in 17 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Mingw-32bit Vs MSVC2013-64bit Shared library issue

    Aparently the first thing I did was that! It is set for sure..

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,620
    Thanks
    13
    Thanked 1,592 Times in 1,520 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Mingw-32bit Vs MSVC2013-64bit Shared library issue

    On Windows you have this coming from Qt:
    Qt Code:
    1. # define Q_DECL_EXPORT __declspec(dllexport)
    2. # define Q_DECL_IMPORT __declspec(dllimport)
    To copy to clipboard, switch view to plain text mode 
    as you can see, you ended up with the value of Q_DECL_IMPORT, which can only mean that your code:
    Qt Code:
    1. #ifdef BUILD_TEST_DLL
    2. #define TEST_IMPORT_EXPORT Q_DECL_EXPORT
    3. #else
    4. #define TEST_IMPORT_EXPORT Q_DECL_IMPORT
    5. #endif
    To copy to clipboard, switch view to plain text mode 
    was preprocessed when BUILD_TEST_DLL was not defined.

    If you add BUILD_TEST_DLL in your PRO file DEFINES, then you must rerun qmake to rewrite the Makefile or the value will not make it to the compiler.

Similar Threads

  1. Qt 32bit working on one 64bit PC and not on anoher 64bit PC
    By Matthiasabt in forum Qt Programming
    Replies: 0
    Last Post: 29th October 2013, 07:10
  2. Building 64bit Shared Qt Dlls on 64bit Win7 for Visual Studio
    By HarrySatt in forum Installation and Deployment
    Replies: 1
    Last Post: 29th November 2011, 04:39
  3. Build 64bit Qt on 32bit XP
    By photo_tom in forum Installation and Deployment
    Replies: 2
    Last Post: 2nd March 2011, 09:28
  4. Deploying 64bit on 32bit OS
    By M. in forum Newbie
    Replies: 7
    Last Post: 23rd April 2010, 22:15
  5. Compiling Qt 32bit on 64bit os..
    By tgreaves in forum Newbie
    Replies: 2
    Last Post: 12th March 2009, 13:34

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.