Sunday 15 March 2015

winapi - How to create Qt GUI application from dll called by win32 console application? -


(If I make a grammar mistake I am not native english)

I am new Qt , Started 2 days earlier, and only had some experiences of WINAPI and MFC. I'm thinking ...

First of all, by creating a QT GUI application from my DLL, my Static Library file (* .bb) will call this DLL file using QLibrary. Finally, in my console app it will have its Lib and its header file, and DLL to create a QT GUI application.

And my console application does not have a .pro file, which is only created in Visual Studio and only .vcproj and .sln files.

Here is the source code:

I copied DLL, Lib and its header files into my Windows 32 console application. And when I compile the console, I get this error message.

Fatal error C1083: File can not open include: 'QApplication': Any such file or directory

I know this is absolutely correct. (Cuz uses my lib QLibrary and its Lib and header file is included in the Win32 console application.)

OK, in fact, to correct me, QApplication in the Bracket Application class The .PRO file is not included with the class. problem.

Is there any possible way to decide when avoiding the .pro file? Or should I set it to create and make it the QT library?

Thanks for reading it. : D

You should point to the path of your compiler QT if you use versus Tools-> Option- & gt; Choose projects and solutions, choose VC ++ directories, set your QT header file paths, Lib paths, bin paths, and set QT bin path for environment variables. PATH In your static library project, try it: < P> create.h

  #pragma create once Qt (int arguments, four * argv []);   

create.cpp

  contains # lt; QtGui / QWidget & gt; QtGui / QApplication & gt; #lt contains &; #include "create.h" #pragma Comment (lib, "qtguid4.lib") Create zeroQ (int arguments, four * argv []) {Q Application app (argc, argv); QWidget w; W.show (); App.exec (); };   

In the console program:

.cpp file:

  #include "stdafx.h" #include "create.h "#Proma Commentary (Lib," Creaty. Lib ") Int main (int argi, four * argv []) {createQt (argc, argv); return 0;}    

No comments:

Post a Comment