Use a Qt library in Visual studio
-
wrote on 6 Oct 2015, 07:44 last edited by
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 -
wrote on 6 Oct 2015, 07:53 last edited by
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". -
wrote on 6 Oct 2015, 07:57 last edited by lmenale 10 Jun 2015, 07:58
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.
-
wrote on 6 Oct 2015, 08:06 last edited by
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.
-
wrote on 6 Oct 2015, 08:18 last edited by
I use visual studio express so MSVC.
This means that I can use a Class in my qt shared library from a VB code?
-
I use visual studio express so MSVC.
This means that I can use a Class in my qt shared library from a VB code?
wrote on 6 Oct 2015, 08:37 last edited by@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#?
-
wrote on 6 Oct 2015, 08:55 last edited by
Ok,
please give more info about "marshalling as in C#"I found this:
http://doc.qt.io/qt-5/activeqt-server.html -
wrote on 6 Oct 2015, 08:56 last edited by
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.
-
I use visual studio express so MSVC.
This means that I can use a Class in my qt shared library from a VB code?
wrote on 8 Oct 2015, 06:05 last edited byIt 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.
-
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.
8/10