Use a Qt library in Visual studio
-
Hi all,
I would like to use a library created with Qt in a Microsoft project.This means that the object in the Qt library have to follow the windows interface.
My scope is to use the Qt class in the Visual Studio project.Thanks,
LM -
Hi and welcome,
@lmenale said:
Hi all,
I would like to use a library created with Qt in a Microsoft project.This means that the object in the Qt library have to follow the windows interface.
I'm not sure to understand what you mean... Qt is no compiler, therefore which compiler did you use? Is your library a shared one?
You need to compile your library with MSVC first.
Then simply add the path to your headers in the new project include path, add the path of the .lib file to the new project library directory and don't forget to add the .lib to the "additional dependencies". -
Thanks for your reply.
Maybe I ask in the wrong way.
My problem is this.I have a shared lib based on Qt classes and my purpose is to use this classes in a Visual Studio project.
-
Which compiler did you use? It changes a lot... If you used MSVC, then you're most probably done, if you used mingw, it can be quite a lot of work, as symbols are no exported by defaults.
-
I use visual studio express so MSVC.
This means that I can use a Class in my qt shared library from a VB code?
-
@lmenale said:
This means that I can use a Class in my qt shared library from a VB code?
I'm afraid I have no clue if using a C++ dll in a VB project works. My knowledge is limited to C++ as far as Visual Studio is concerned. Maybe you can use marshalling as in C#?
-
Ok,
please give more info about "marshalling as in C#"I found this:
http://doc.qt.io/qt-5/activeqt-server.html -
I code as little as I can in C#, therefore I'm not the person who could answer this as best. Moreover I have no idea whether there is an equivalent functionality in VB.
-
It seems you're asking a question that has nothing to do with Qt, honestly. It seems what you're really asking, is whether you can call into a shared library, which presumably was build using MSVC (you didn't quite answer that crucial question yet), from a VB code, which you also compile in MSVC.
If that is correct, it seems to me you'll need to look into some MS documentation, like this: https://msdn.microsoft.com/en-us/library/dt232c9t.aspx
There is nothing special about a shared library built on top of Qt, compared to any other library (except for some runtime dependencies on Qt dlls). Whatever is true for any shared (c++) library compiled using MSVC, will be true for your library as well.
-
@Jakob
The link that you give me it's enough for what I have to do.The answer on your question is I build a qt shared library using MSVC.
Thanks.