can we use Qt(64) to produce an application that will work on both 32bit windows and 64bit windows? - c++

http://qt-project.org/downloads . I downloaded the openGL since many say this set standard is better. but now i got requirement from my prof that I need to provide something that can work on windows 32/64. Is there any way that i do not have to install Qt for windows 32 and produce an application that can be run on windows 32?
what I am saying is that I only installed Qt for win64 but now I want something can work on win32 platform. so I suppose one way is to install Qt for win32 and create a new project. But I want to ask whether I can maybe do some configuration and produce something that can work on win32 using the installed Qt on win64 on my com
thanks!

For Windows Vista and up, there's no reason not to use the ANGLE implementation of OpenGL that's bundled with Qt. "many say tis set standard is better" - this is false unless you can guarantee that your customers have a decent OpenGL-supporting graphics card driver installed on their machine. I'd suggest forgetting about system OpenGL, and use ANGLE implementations.
It's trivial to compile your project for both 32 and 64 bit Qt, if you really need the 64 bit address space. For many applications, there's no reason at all to provide a 64 bit version.

No, you can't do it directly.
The only way to launch 64-bit applications on 32-bit Windows is to use emulators and virtual machines, for instance VMWare. But it reduces the application performance.

Related

Is it possible to make 32 bit gRPC and protobuf?

Is it possible to make this library as 32bit? By default, this builds as 64bit.
How can i include this library in my 32bit application?
There's ways to cross-compile libraries, but it's usually easier to build from a 32 bit system if you don't know how. You can debootstrap a 32 bit userspace on your own system and use chroot to access it.
https://jblevins.org/log/ubuntu-chroot
It certainly is possible. Actually, one of gRPC's continuous tests is testing that the 32bit build works well.
We are using this 32bit dockerfile to build:
https://github.com/grpc/grpc/blob/5059fd195753d0c18e51efa930aebd7e0461ed51/tools/dockerfile/test/cxx_jessie_x86/Dockerfile
You can also crosscompile as others are mentioning above. You're not mentioning if you are building on linux, windows or macos, so I assumed you're on linux but building a 32bit grpc is possible on windows and macos too (and perhaps easier than on linux).

Need to use Volume Shadow Copy Service in 32/64 bit QT C++ program

I have a couple questions about using Volume Shadow Copy Service for my QT C++ program.
I read that in order to use VSS you must be running native 32/64 bit
no WOW64 supported. So this means I need to compile my program in
whatever bits Windows is using on the computer where the program exe is running correct?
Do I need to use MSVC or can I do this using MinGW?
If I need MSVC how do I do a static build for 32 and 64 bit? I found the first 4 links on google for "qt msvc static build" but they all vary a little bit so I'm wondering which is the best to use.
Also for either MSVC or MinGW do I need to include VSS libraries in the project? I need to get the VSS SDK correct? How do I integrate such into the program? I already know the code to use.
Thanks :)
That is correct, the program must be compiled to match the target OS's architecture.
Since most of the VSC API is COM, I don't really see how trying to do this using MinGW would be better.
In Visual Studio, all you need to do is to include the VssApi lib, i.e.
#pragma comment (lib, "VssApi.lib")
All you really need are the VSS specific headers. This also really depends on the OS your're targeting. If you plan on supporting say, Windows XP, you'll need the XP specific SDK.
Some reading: https://technet.microsoft.com/en-us/library/ee923636(v=ws.10).aspx

USB Programming with Qt

Is there anyway I can do USB programming in Qt? I am using Qt Creator 2.6 which is based on Qt version 5.0.0 and it is the latest Qt Creator which works with the Microsoft Visual Studio 2010 compiler.
I have the toy called "Dreamcheeky Thunder Missile Launcher" and I need to program this USB based device.
I have tried LibUSB but it messed up everything. It even renamed the device port and I had to undo everything using USBDview software. But I guess I installed it incorrectly. I followed these instructions. It is instructions for 64 bit, but I got 32 bit and since the instructions seems not to have big difference (instead the download file) I followed it. This is what I downloaded - libusb-win32-bin-1.2.6.0.zip
Whatever the API you recommend it doesn't matter, even libusb, but please be kind enough to tell me how to install it properly.
My OS is windows 7 ultimate 32 bit.
ollo's answer is out of date. TL;DR is use libusb.info. A bit of explanation:
Originally there was libusb-0.1. Later they updated the API to libusb-1.0, but since libusb-0.1 had been around so long many projects didn't bother switching (kind of like Python 2/3). libusb-0.1 was not available for Windows, but libusb-1.0 is now available for all major platforms.
libusb-win32 is a port of libusb-0.1 to Windows. You shouldn't use it for new code.
libusb.org is the old website for libusb. The latest release is from 2012 and there are no Windows downloads.
libusb.info is the current website for libusb. It contains libusb-1.0 downloads for all platforms and you should use this for new code.
To further confuse things, the sourceforge libusb-win32 mailing list is still used for libusb.info's development.
There's another good instruction for libusb here: http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/
libusb:
libusb
libusb-win32 (windows port - use this on windows!)
If you stay on windows you can use
WinUSB:
WinUSB API
Example
Installation
For windows you can use both, but if your program has to be cross-platform you should use libusb.

Writing a cross-platform program

How could I write a program which runs on both Windows 7, Mac OS X (and maybe linux too)?
I heard Qt are a great framework to build cross-platform GUIs, but I think every program version need a recompile, isn't that right? And should I compile the win version under windows, the mac version under mac os x, the linux version under linux and so on?
I'm getting ideas and/or suggestions
The underlying binary format is different on each platform, so unless you're using a virtual machine (like Java or Flash does) you will have to recompile your program on each platform.
Some compilers (like GCC) allow cross-compiling, but it is not trivial to set up. Probably the easiest system to cross-compile on is Linux (there are several open source projects that have cross compilation set up from Linux to Windows).
In case of a GUI application, it depends on the language -- if you're stuck with C++, Qt or wxWindows might be a reasonable choice providing an abstraction layer over the native windowing system.
If you can go with Java, it makes life simpler, however the windowing system is Java's and not native.
Another language to think about is FreePascal w/ Lazarus -- it has a pretty good GUI designer that compiles to the native windowing system on every platform (WinAPI on Windows, Cocoa on OSX and GTK on Linux).
Not sure if C++ is a must, but Adobe Air is a great cross platform development environment for desktop, and its growing for mobile development as well. If you need an example of a major application using Adobe Air to deploy to multiple desktop OSes, just check out tweetdeck http://www.tweetdeck.com/
I'd highly suggest also looking into Flex and Flash Builder if you go that route.
There are two separate issues I would highlight when writing cross-platform programs -- how to make your code portable, and how to arrange for it to be built on the various different platforms.
As far as the building side of things goes, I would look into a cross-platform build system like CMake (http://www.cmake.org). You essentially write a script and CMake will generate the appropriate project file/makefile for a specific platform. You then build your program on each platform as you would normally. For example, on Windows, you might use CMake to generate a Visual C++ project for you, and then use Visual C++ to actually build your executable. On Linux, you might use CMake to generate a makefile, and then build the executable using g++.
The other aspect is how to make your code portable -- the key is to write C++ standard-compliant code and make use of libraries that are themselves portable across the platforms you're interested in. You can (and may sometimes need to) write platform-specific code for each of the different platforms -- if you do, you should hide it behind a portable interface and have the rest of the code use that.
Yes, you need to compile for each version when using C++.
The only thing that prevents you from compiling a program, for example, for Windows on Mac is to get a tool for doing that. It is possible, but the problem is finding the toolset.
Also you can use a virtual machine for running diferent OSs and compiling code for all platforms on the same machine.
Java runs on Windows, OS X and Linux

Desktop Development Environment that Compiles to Linux, Mac OS, and Windows

is there any development environments that allow you to have one code base that can compile to Linux, Mac OS, and Windows versions without much tweaking? I know this is like asking for where the Holy Grail is burred, but maybe such a thing exists. Thanks.
This is achieved through a number of mechanisms, the most prominent being build systems and specific versions of code for certain systems. What you do is write your code such that, if it requires an operating system API, it calls a specific function. By example, I might use MyThreadFunction(). Now, when I build under Linux I get a linux specific version of this MyThreadFunction() that calls pthread_create() whereas the windows version calls CreateThread(). The appropriate includes are also included in these specific platform-files.
The other thing to do is to use libraries that provide consistent interfaces across platforms. wxWidgets is one such platform for writing desktop apps, as is Qt and GTK+ for that matter. Any libraries you use it is worth trying to find a cross-platform implementation. Someone will undoubtedly mention Boost at some point here. The other system I know if is the Apache Portable Runtime (APR) that provides a whole array of things to allow httpd to run on Windows/Linux/Mac.
This way, your core code-base is platform-agnostic - your build system includes the system specific bits and your code base links them together.
Now, can you do this from one desktop? I know you can compile for Windows from Linux and so probably for Mac OS X from Linux, but I doubt if you can do it from Windows-Linux. In any case, you need to test what you've built on each platform so my advice would be to run virtual machines (see vmware/virtualbox).
Finally, editors/environments: use whatever suits you. I use either Eclipse/GVim on Linux and Visual Studio on Windows - VS is my "Windows build system".
Maybe something like CodeBlocks?
Qt is a good library/API/framework for doing this in C++, and Qt Creator is a very pleasant IDE for it.
I've heard this is possible. Your compiler would need to support this. The only one that I know that does is GCC but it obviously requires a special configuration. I, however, have never used this feature. I've only seen that it exists.
What you are looking for is called "Cross Compiling"