Porting a Qt Application from Linux to Windows - qt

I built a qt application that uses opengl on linux and am trying to build it on windows. I used g++ to make it on linux and am using command line nmake for Visual Studio 2005 to build it on windows. When I tryed to build my application I typed
qmake -makefile app.pro
nmake
The nmake failed and said "bool qt_win_owndc_required"... already defined in QtOpenGld.lib ..
one or more multiply definded symbols found
When I tried building one of the examples (hellogl) with opengl it resulted in the same error message. But when I tried building a different example without opengl it worked fine. Do I need to do something special to build the opengl library correctly? Is there something that I am not thinking of?

Are you running qmake in a Visual Studio 2005 Command prompt?
A google search turned up this post: http://www.delta3d.org/forum/viewtopic.php?showtopic=15723
The guy fixed the problem by rebuilding the source.

Related

QT Creator cannot find "objbase.h" when invoking nmake

When attempting to build my Qt project with MSVC2015 64bit for Windows 10, I get this error:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Ole2.h:37: error: C1083: Cannot open include file: 'objbase.h': No such file or directory
...
NMAKE:-1: error: U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.EXE"' : return code '0x2'
NMAKE:-1: error: U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\nmake.exe"' : return code '0x2'
-- when nmake is invoked during the build process.
This exact same error also occurs for the example project "addressbook".
It appears to be some kind of toolchain issue, but I can compile a Qt Widget project in Microsoft Visual Studio 2022 if I point VS at my Qt installation.
I'm not sure what I need to do from here, since I already tried a reinstall of Qt. I have seen that putting things in Program Files is generally a bad idea, but that doesn't seem to be the issue in this specific case.
It appears to be part of the Windows SDK, if Google leads me right. However, I did not have to download the Windows SDK separately in order to compile my project and run it successfully before. (For context, the project's been developed for a few months and this problem only emerged a week or so ago).
My QT Installation:
Kit: Desktop Qt 5.15.2 MSVC2015 64bit
Version: Qt 5.15.2 MSVC2015 64bit
Compiler: Microsoft Visual C++ Compiler 17.3.32811.315 (amd64)
Things That Have Happened Before My Build Attempt:
I recently reinstalled Qt 5.15.2 in an effort to resolve a similar missing file issue.
The company's recently had issues with Microsoft Intune deleting applications. Maybe it hit the Windows SDK too.
Attempts at Solving the Issue
Reinstallation of Qt 5.15.2
Expected: My project building without errors. Result: This error.
Search of file system for objbase.h
Expected: Finding the file. Result: I did not find the file.
I'm newish at Qt, so I didn't want to try anything more esoteric lest I made things worse than before.
Update: MinGW 64 bit works for the example Qt projects, but I'd still like to use MSVC2015 if possible. It doesn't work for my project because I use some MSVC specific pre-processor flags in my source.
Update 2: I attempted to re-download MSVC 2015 from Visual Studio's website, using their Build Tools installer. While the installation successfully finished, I got no change from before -- it still can't find that "objbase.h" file. It's supposed to be in the Windows Kits directory under Include//um , I think.
It appears that, in my case, the objbase.h file was deleted due to the issue with Windows Defender deleting random files. I was able to reinstall the version of Windows SDK that was using and this fixed the issue for me.
I figured it out. I'm posting the solution here for others.
My issue was that, for reasons that are unclear to me, VS Studio Build Tools would not actually remove the SDK in question if I unchecked its box in the Modify screen. You can tell if this is happening by checking the disk size difference of the upcoming installation in the lower right of the screen -- if it won't remove the SDK, that size will be +0 bytes (assuming you don't check or uncheck any other box).
In order to properly reinstall the SDK version, I had to go to "Add or remove programs" and find the SDK there, uninstall it, restart my computer just for safety, and then go to VS Build Tools and install that SDK version. I had to do a "fake" uninstall with VS Build Tools (basically, uncheck the now-deleted SDK and click "Modify", allowing it to do the installation and download steps) before I could actually install the SDK again.

MPI with MinGW and Eclipse

My question is devided in two parts :
What is the best combination to execute MPI program in C language, when i searched for the necessary tools i found who work with Visual Studio and MS-MPI , and who work with Eclipse PTP or Code::Blocks and MPICH2 MPIOpen so i didn't know what to choose and what are tools that are compatible which other?
So ive installed OpenMPI,Eclipse PTP (Kepler) and MinGW-w64 to compile some C programs using MPI on windows 7 64Bits. i set all paths such as mpicc.exe i tried to test the Hello world program which is include with eclipse as example, i got this error:
13:03:48 **** Incremental Build of configuration Debug for project A ****
Info: Internal Builder is used for build
mpicc "-IC:\Program" Files "(x86)\OpenMPI_v1.6.2-x64\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\A.o" "..\src\A.c"
The Open MPI wrapper compiler was unable to find the specified compiler
cl.exe in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
13:03:48 Build Finished (took 115ms)
So i searched for cl.exe in my computer but i didn't found it, when i looked for some solution i found that the majority who solved this cl.exe problem are using visual studio, which is not my case so am little bit confused i dont want to switch to Visual Studio, so any solution with the tools that am using ?
OpenMPI does not appear to officially support MinGW as a backend: https://www.open-mpi.org/software/ompi/v1.6/ms-windows.php
The installers were configured with CMake 2.8.1 and compiled under Visual Studio 2010, and they support for C/C++ compilers of Visual Studio 2005, 2008 and 2010.
https://www.math.ucla.edu/~wotaoyin/windows_coding.html and other sources found on a search describe workflows using MS-MPI with MinGW. It may be a viable alternative. VSCode and MPI in WSL describes yet another non-paid but proprietary approach using VSCode with the WSL plugin.

Run Binary With Specific QT Version - Cannot mix incompatible Qt library

I'm trying to replicate an application that we currently have running on a physical Ubuntu server using an Ubuntu machine in Virtual Box. It is a QT application but on the server we are running it using pm2 from NPM. After installing QT, and installing drivers needed for the application i've tried to run it but keep coming across this error:
Cannot mix incompatible Qt library (version 0x50701) with this library (version 0x50905)
I've inherited the code from someone else and don't want to change the project to QT5.9.5, so i'm trying to run with 5.7.1, I've followed instructions on other questions in order to change the QT version to 5.7.1 but still get the same error when running it.
I followed the instructions here:
https://unix.stackexchange.com/questions/116254/how-do-i-change-which-version-of-qt-is-used-for-qmake
When checking the QT version using "qmake -v" in the console I get the following output:
QMake version 3.0 Using Qt version 5.7.1 in /home/sam/Qt5.7.1/5.7/gcc_64/lib
So although it looks to me like i'm using the desired version of Qt (5.7.1), i'm still getting the incompatible library issue, i'm very new to all of this so apologies if this is a stupid question. If anyone could tell me what to do in order to use the compatible library that'd be great, thanks.
I will try to explain this in steps!
Each complete set of Qt libraries is called a Qt "distribution". You can get Qt distributions from a variety of sources:
Installed from the package manager of your OS (.deb/.rpm).
From a downloaded zip file on http://qt.io
As a cloned repo from git
etc..
Some of the available Qt distributions will come pre-built, and some will need to be built from sources. In either case they will all have a qmake program that is specific to that particular Qt distribution. This program is responsible for building programs so that they link to the particular Qt distribution that the qmake is part of. qmake is also used when building with QtCreator.
If you have a binary built with one qmake and you try to run it on another computer, it might find the wrong Qt libraries during dynamic linking and spit out errors of "incompatible version of Qt".
There are many solutions to this problem;
Collect all the Qt libraries (Mine are in /home/myusername/Qt/5.version/gcc_64/lib/*.so) in the same folder as your program executable. This will make sure they are prefered to any other version of Qt that may be in your dynamic linker's path.
Uninstall the OS supplied Qt version(s). This may not be advisable especially if other programs use them.
Rebuilt your program from source using the correct qmake.

Compiling and linking library MSVC/MingW

I'm a big fan of StackOverflow because you always have answers for problems, and now is my chance to get advance of it Ö!
I'm trying to use a library which I got in the Internet, its OZCollide. Its suppossed to be crossplatform as it says in its website "Cross-platform, works on Windows, Linux and Macintosh, in fact any platform supporting VisualStudio 6/7 or gcc"
I got all the .h and .cpp, compile them with MinGW as objects (.o) and then link them all using ar. But the problem is when I include and use the library on my project (QT & MinGW) it throws "undefined reference".
I thought the problem could be that library examples only uses Visual Studio, so the library coulnd't be compiled for MinGW, but the website tells other story.
Thanks for your time!
EDIT: Okay I have managed to compile it and use it moving to another computer and compiling makefile. The only one difference is that Computer A had Cygwing and MinGW installed (with Cygwin set up in Windows path) and Computer B only had MinGW.
So I guess the problem was Makefile calling for g++ and Cygwin g++ got called instead of MinGW g++??
If I'm right, whats the difference between Cygwin and MinGW?
if you have experience with CMake, create your own CMakeLists file and import/link this libraries against your project. In this way, you can create projects for MinGW/MSVC/Linux/etc.
Here you'll find a good start with CMake http://www.cmake.org/cmake-tutorial/

Can you install Qt-4.6.0-wince successfully?

I'm trying to install Qt-4.6.0-wince on XP and Vista. I read the instructions and follow it to install.
However, I can't install it successfully due to some fatal errors on all of the two machines. I think the problem is that qconfig.[h cpp] files are not created automatically during the configuration.
I already report about this problem, so you can see the more information here. However, it is still remained as unresolved.
Anybody here who has been installed it successfully?
#KernelJ I believe the original poster is using the correct install distro - the final product will be cross compiled from Win32 to WinCE; as is pointed out in the Qt for Windows CE Requirements.
#Brian, Unfortunately, I can't answer your original question - I have had unrelated trouble with the WinCE distribution myself and am working the issues now. However, I can provide some help: I was able to get the Qt Everywhere 4.6 to cross compile on my Win32 (XP) host for WinCE. I used the commercial version, but here is a link to the Open Source Qt Everywhere 4.6 package. As is pointed out in the nokia instructions, make sure to use the Visual Studio command prompt, get your environment variables ironed out, create a custom mkspec (if you have to), and keep a close eye during the configuration for any warnings.
Good luck.
Qt-4.6.0-wince, as is implied in the name and said explictly on the page you linked, is for Windows CE, NOT for Windows XP and Vista!!!
Nokia have released a nice software development kit for Qt which you can download here. It is very impressive and powerful!
I got things running as compilable (and running on emulator) with VS 2008, so your milage may vary:
Make sure the PATH variable points to \bin
Open a command prompt (using the Visual Studio Command Prompt)
Run the vcvars32.bat file (in C:\Program Files\Microsoft Visual Studio 9\VC\bin) folder
Cd into the qt folder
Run this: configure -no-sql-sqlite -no-qt3support -platform win32-msvc2008 –xplatform wincewm50pocket-msvc2008 -no-phonon -no-phonon-backend -no-webkit (building for WINCE 5.0, and all the '-no-...' makes it build faster, removing stuff we don’t want)
The setccepaths script provided sometimes doesn’t work. I used checksdk.exe –script temp_script.bat (It creates a script, the default is for Pocket PC SDK 5)
Run that script you just created (the temp_script.bat thing. It sets up environment variables.
Run nmake
*whew*
and good luck.

Resources