Qt/QuickFIX - doesn't find some header files - qt

I am using both Qt Framework and QuickFIX engine to create a financial application with GUI.
My problem is that when I compile a program that implements QickFIX engine and Qt Framework, it gives me a compilation error: it doesn't find some header files in MinGW (socket.h, inet/in.h, etc)
I am on Windows 7 and I know that to use sockets you must use winsock.h and so on, but the problem is I have Visual C++ express edition and it's not supported by Qt, so I used Qt Creator and since I have an open source of Qt, QuickFIX engine uses the header files of Linux (socket.h, etc) rather than windows. So it gave me an error.
Please can you suggest me a solution?

I use Visual Studio Express 2010 with Qt. You will need to build Qt with it. When you configure make sure to specify Visual Studio 2010 as the make spec.Last time I built it got hung up on a couple of projects. To get around this you need to clear out some temporary files that Nokia packaged in the installer for some reason. Just google the error for details.
Once you have Qt built you ought to be able to qmake -tp vc your project and then load up the generated Visual Studio project file.

Related

How can I compile QT 4 dlls with msvc 2019?

I have an old project using QT 4.6.2 that runs on VS 2008. I was able to compile it in VS 2019 with msvc 2019 toolchain but it crashes in run time. I see that the problem happens because when I use the QString::toStdString() function, it involves QTCore4.dll using msvc90.dll (VS2008), but when destroying the std::string the app uses msvc2019. This mismatch ends in the app crash.
I want to fix it by recompiling QTCore4.dll using the msvc 2019 but have no idea how to do this. I got the dll by installing QT and have no instructions how to recompile it.
Is it even possible or is it closed source?
I assume upgrading to QT 5 is also an option but I would like to stay with QT 4 for now.
Qt 5 is largely source compatible with Qt 4. I would first highly recommend trying to compile your project (and fixing any small issues) against Qt 5.
If you need the Qt Declarative module, you can compile it against Qt 5 if you must.
That being said, Qt is released under the Open Source LGPL license.
You can fetch the Qt 4 source code from github: https://github.com/qt/qt
Building Qt 4 involves having perl installed and running configure followed by nmake (for Visual Studio). You will need to set up some new things for Visual Studio 2019, and potentially fix code incompatibilities that the 2019 version compiler digs up.

How to build an existing Qt project in Visual Studio?

I have a visual C++ project that contains references to Qt libraries but I am unable to build it in Visual Studio. I installed Qt 5 sdk and plugin in VS 2012 and the initial sample Qt projects work fine, but not the older project - it could be an issue related to the project being compatible to an older version of Qt - but I don't know how to solve the problem. The error keeps showing - "The system cannot find the path specified visual c++. Moc'ing .. Uic'ing.."
The error says MSB6006: "cmd.exe" exited with code 3. The solution explorer contains some moc_xx.cpp files which are only references and are not present in the project directory. I removed them and tried rebuilding but it gives the same error
QTDIR must be set prior to starting Visual Studio for the project to properly find the location of moc.exe and uic.exe.
The Qt Visual Studio Add-in will create custom build steps for .ui and header files whenever Qt files are added or modified. It is then Visual Studio that runs the custom build rules but these rules typically reference $(QTDIR)\bin\moc.exe.
I too had the similar issue recently with an old VS project created years ago by a colleague.
The VS project was created using qmake. It contains the absolute full path to the moc.exe, of the machine where it was originally created. That is, of the PC of my colleague who left the team.
I do not have moc.exe at same location as he had it.
Therefore, the MOC step in build fails, with the error: the system cannot find the path specified.
You could find what the path is, by raising build output verbosity to diagnostic for instance.
Hope it helps.

Deploying Qt with MinGW requires VC++ redistributable?

I'm testing an application using Qt 4.7.3 compiled with MinGW on a clean XP virtual box. The application wasn't working and after much grief, I traced the error to needing to download the Visual C++ 2005 redistributable. I downloaded this and it worked. Something doesn't seem right here, shouldn't I not need any VC++ libraries since I'm using MinGW? Could it be a problem with my compilation? I should mention that I'm not using qmake to build.
The dependency on MSVCRT.DLL is due to MinGW itself. To quote mingw.org..
MinGW provides a complete Open Source programming tool set which is
suitable for the development of native MS-Windows applications, and
which do not depend on any 3rd-party C-Runtime DLLs. (It does depend
on a number of DLLs provided by Microsoft themselves, as components of
the operating system; most notable among these is MSVCRT.DLL, the
Microsoft C runtime library.
Also see: Should I redistribute msvcrt.dll with my application?
As noted in the Qt documentation, yes, that is required:
http://doc.qt.io/qt-5/windows-deployment.html

problem with QT and visual studio 2010 ultimate in debug build

I install vs 2010 ultimate and "qt 4.7.1-vs 2008" qt-vs-addin-1.1.7. Now every thing is configured but when i make a debug build of qt application i am getting
"The application has failed to start because the application configuration is incorrect".
This is probably because vs 2010 is compiling to msvcp100d.dll where as qt is compiled with msvcp90d.dll. Can you please let me know how the problem can be resolved thanks in advance....
I'm not working with Windows releases for a long long time but if Nokia doesn't provides a compiled release for VS2010 why don't you compile Qt from the source? It takes a while but it's the right thing to do.
PS:
Looking through the Qt Software download page it doesn't seems to have a VS2010 release, at least for the LGPL version. Then, you really need to download the source and build it.
Just in case you need from reference on Qt build process, take a look at this:
http://en.wikibooks.org/wiki/Opticks_Developer_Guide/Getting_Started/Building_Qt_From_Source
Configure options for you case may be different.
Also, be warned that according to this VS 2010 is not a Tier 1 platform for Qt.

Porting QT application from Linux to Windows?

Greetings all,
We are developing a QT application (QT 4.6 LGPL version) in Linux platform.All the libraries we use are cross-platform.
Now we want to port it into Windows and continue develop in Windows.
My questions are:
Which compiler should we use ,Can we use MinGW or Visual C++ compiler?
2.If its Visual C++ compiler, which Visual Studio version should be used ,can we use 'Visual C++ Studio 2010 express' ?
thanks in advance.
The easiest, by far, is to install QtCreator. it includes MinGW and simply opens the same project files as on linux. compile, and go!
A huge advantage of MinGW over VC++ is that it doesn't make you chase circles around getting the right vcredist library for the exact version of the compiler, nor it cares too much about debug/release builds. To deploy, just be sure to copy the same one or two DLLs you have on the development machine. A few more for Qt, but these are well-documented on Qt docs. No hidden surprises.

Resources