Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Calling VS DLLs :(

[Solved] Calling VS DLLs :(

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MwRain
    wrote on last edited by
    #1

    Hi
    Can somebody give me a clue - I'm trying to call a VS2010 DLL from Qt5.2.1 (for VS2010).
    I've successfully called the DLL from VS and I've successfully called a Qt DLL from a Qt host app. But when I try to call the VS DLL from Qt the same way I call the Qt DLL, I get the "LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MyCDllClass::MyCDllClass(void)" plus the same messages for the destructor and the Test() method.

    To use the DLL in Qt, I simply use Add Library -> External, then select the .lib file and then with Add Existing Files, I add the header of the DLL, which looks like

    @#ifndef MyCDllClass_H
    #define MyCDllClass_H

    #ifdef MYCDLLCLASS
    #define DLLCLASS __declspec(dllexport)
    #else
    #define DLLCLASS __declspec(dllimport)
    #endif

    class DLLCLASS MyCDllClass
    {
    public:
    MyCDllClass(void);
    ~MyCDllClass(void);

    void Test();
    };

    #endif
    @

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Don't use Add Existing Files to include external library headers. Use INCLUDEPATH in your .pro file instead.

      (Z(:^

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MwRain
        wrote on last edited by
        #3

        Ok, thanks, I'll definitely try that and see how it works!

        In the end the problem was mismatched files and that I had to uncheck the "Add -d suffix for debug version". Stupid of me. Sorry for the bother, but while things didn't work, everything started to mess up and I spent half a day tearing my hair, so finally decided to call for help.
        And, as expected, a while later I find it's my own stupid mistake.

        Thanks and cheers ;)

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          [quote author="MwRain" date="1396431194"]Sorry for the bother, but while things didn't work, everything started to mess up and I spent half a day tearing my hair, so finally decided to call for help.
          And, as expected, a while later I find it's my own stupid mistake.[/quote]

          No problem, I guess those kind of situations happen to every programmer occasionally ;)

          (Z(:^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved