Is it possible to use vs2010 c++ and use Qt for all platforms? - c++

What i hear about Qt, is that it is providing an operating system independent layer.
To do well most tasks a coder normally does. To perform at best the code has to be c++
While there is also mono providing some translation to c++ and there Dot24 an android c# kernel.
Currently the things we do, cannt be done in mono, for hardware reasons.
So i am thinking of going back to pure C++ and QT instead of C#.
Now what i am wondered about
By itself c++ is a standard and should also be idenpendent for linux/windows/unix/microboards/Ce devices etc etc.
But if i would write using VS2010 c++ and QT would i still have advantage my code would run on a wide range of platforms ? . As visual studio, creates a windows based exe? Or should i use also another IDE to write truely independent c++ with Qt?

C++ is a compiled language, whatever IDE/compiler you'll use it will produce executables for a certain platform. But the point of Qt is that, as far as you avoid platform-specific code, your sources can be recompiled on the various platforms, generating a different executable for each supported platform. So, using VC++ is not a limitation as far as sources are concerned.
The limitation comes instead from the build system: Visual C++ uses its own format for project files, which is not compatible with makefiles & co. So, if you started your project as a VC++ project, you would have to re-create manually a Makefile or similar to compile on other platforms.
To avoid this kind of problems, Qt provides qmake, a tool that, provided a .pro file (roughly equivalent to a .vcproj), is able to generate build files for various platforms: .vcproj/.dsp on Windows, Makefile on Linux and OS X, XCode projects on OS X and probably others.
So the point is: you can use Visual Studio, but you should use Qt's build system to be able to port your application to other platforms without any fuss.
Also, you can consider using Qt Creator, which supports directly .pro files, has particularly good integration with the Qt features and works on Windows, Linux and OS X; on the downside, I noticed that the debugger in Visual Studio tends to be way better.

If you have cross-platform C++ code using Qt, you can edit and compile the Windows version using Visual C++ (the compiler that comes in Visual Studio).
Visual C++ still only creates Windows executables, though, so to actually build and run on other platforms, you'll have to get another compiler (but feed in the same source code).
One pain point will be with makefiles: visual Studio has its own project format and cannot process standard makefiles. Neither do other platforms use Visual Studio projects. Visual Studio does come with a tool called nmake which is similar to POSIX or GNU make, but still not compatible except for the most trivial features. And of course cl.exe uses different command-line switches than other compilers. So you'll end up maintaining one set of C++ files but two or more sets of makefiles.

Yes it is possible to develop Qt applications in Visual Studio that can be used on other platforms. For example for my work in medical imaging research, I develop all of my Qt based applications in Visual Studio 2010 with the visual studio project files generated using CMake and at times build some of these applications in linux under QtCreator or KDevelop using the same CMakeLists.txt to generate project files for for these IDEs. As long as I stay away from platform specific code the porting is not that difficult.

In order to develop qt apps qtcreator is the best ide, qtcreator available on linux and mac, so you can open your qt project and build on any platform easily.

Related

Cross Platform c++ and Visual Studio 2017?

Is it possible to compile c++ project for Windows, Mac, Linux in Visual Studio 2017?
If not please give me a best way to compile for cross platforms.
No. It is not generally possible to do that with Visual Studio.
In my opinion, the best approach is to configure your CI system to spin up virtual machines running those other operating systems and then perform the build natively in the VM using whatever compiler those systems provide (like GCC & Clang). With the help of a build system like SCons or CMake you can abstract away most of the platform specific compiler bits.
A bonus is that building your code (and running your tests) with multiple compilers is a good way to find bugs.
Visual Studio 2017 added support for building and debugging for Linux, either on a remote machine or using some new built in local subsystem.
A fully cross-platform solution for you, porting your existing projects from VS could be as follows:
Start by converting your entire solution tree to a CMake project (VS 2017 fully supports loading such a project instead of the MS project format of the .sln and .vcxproj files). You can try a conversion tool like this one.
Now that you have a CMake project you can use the CMake build system directly from any other platform. For example on a Virtual Machine running your target OS. There, all you need is configuring your CMake project to build with clang/gcc instead of msvc.
If you prefer staying closer to home for now, in terms of editor/IDE that can be configured to build from the GUI -- kind of like the VS you're used to -- look for a cross-platform editor that supports CMake projects like VS Code.

Where is cl.exe? (MS Build Tools ’13)

I just want the VC++ compiler, since some C++ graphics libraries (I'm planning to use and learn bgfx...) require it for compilation. For this I’ve downloaded and installed Ms. Build Tools ’13. However, I can’t find it.
My attempts:
1) I’ve ran Windows Command Prompt using the Batch input cl and it echoed 'cl'is not recognized as an internal or external command, operable program or batch file..
2) I’ve searched for a file with filename cl.exe on both "C:\Programs Files" and "C:\Programs Files (x86)" paths recursively and nothing. There’s no top folder related to MsVC++ or VC++ too, on the disk.
I cannot try to install Build Tools ’15 (nor VS) since the installer downloads at minimum 3 gygabytes and my network isn’t good.
Where can I find the compiler? Otherwise, is there any cross-platform graphics library (at least for Windows and Mac) that doesn’t need MSVC++ (e.g., just G++), please?
As a commenter mentioned, the Microsoft Build Tools 201x include tools to build managed apps (i.e. .Net apps), not native C++ apps. That's the answer to "where is cl.exe?" It's not there. It was never there.
That's true for the Microsoft Build Tools 2015 too, despite what you think and said. You're mixing up Microsoft Build Tools 2015 and Visual C++ 2015 Build Tools. Note the "C++" there (and the order of some of the words).
The Visual C++ Build Tools are the supported and recommended way by Microsoft to Build visual C++ projects without installing Visual Studio.
If your problem is internet connection get someone else to download it for you, seriously. You're really looking at it the wrong way.
Another alternative is the Enterprise WDK. It's "only" 1.9GB.
Otherwise, is there any cross-platform graphics library (at least for Windows and Mac) that doesn’t need MSVC++
Yes, you should be able to use modern OpenGL in a cross-platform way under Mingw using
GLFW (since it's a CMAKE compile-it-yourself library) and the excellent GLAD for handling loading of the modern openGL API on windows.

Creating a portable, cross-platform, open-source C++ GUI application that works out of the box?

I've been looking around to see how I'd accomplish that which is described in the title. That is, I'd like to create a C++ GUI application that:
is portable (no installer)
is cross-platform (Qt solves this)
is open source
works out of the box (i.e. no C++ redistributable installs needed)
I've run into several issues trying to accomplish this. I've narrowed it down to using Qt and NOT using the Visual Studio compiler. Let me explain.
Using Qt would fulfill the cross-platform requirement; it's also highly acclaimed in regard to C++ GUI applications. The issue lies with portability and not having a ton of dependency packages to install before being able to use the application. My goal would be for someone to download a .zip file containing an .exe (and I'd be willing to include other support files e.g. DLLs if necessary) and be able to extract and run that exe out of the box without having to do anything else.
And here's another kicker: as much as I'd like to use Visual Studio (with the Qt Visual Studio Add-in), it just doesn't seem feasible given my requirements. This post covers my issues pretty nicely. Simply put, if I use the Visual Studio compiler, I'd need to either create an installer (no longer a portable app), redistribute some Microsoft DLLs with the app (possible licensing and redist issues here?), or statically link the Visual C++ libraries into the executable (frowned upon technique).
Is there any way to be able to use Visual Studio and fulfill the requirements listed above? Visual Studio is just too fully-featured to pass up. If it's not possible, I think the only other alternatives would be to use a different IDE and/or compiler. For example, I could use QtCreator with MinGW, but then I'd be losing out on some awesome VS debugging features.
My main questions:
Is there any way I can fulfill the requirements above and still use Visual Studio?
Am I wrong about QtCreator not being as fully functional as Visual Studio?
What would be the best way to approach fulfilling my application requirements?
Thanks in advance.
I think your best bet would be to use QT with the MinGW environment. It allows you to create a portable application that supplies runtime DLLs by itself, with added bonus of being completely open source. The QT online installer gives you the option to install the complete MinGW system, and it will work out of the box, not much setup needed.
You could still use Visual Studio for development; there even is a QT plugin for it (I am not sure if VS2015 is supported, but if not that should only take some time).
QTCreator is actually a quite nice IDE, but it cannot stand up to Visual Studio. It is obviously optimized to cater to the needs of QT programmers, but I found that it is quite clunky from time to time. If your project is small it could be a viable choice, but since Visual Studio 2015 Community is basically free I would opt for that. The VS plugin will still use QTCreator's GUI editor though (which is really good)

Visual studio 2010 project for windows and linux

I'm trying to make a program that works on linux and windows.
I'm writing the program in visual studio in a windows environment.
So I wonder how I could compile my project from visual studio to linux.
The Microsoft C++ compiler is not capable of producing Linux executables.
You will need to use a more portable compiler for your Linux executables, e.g. gcc. Perhaps you may benefit from a cross-platform IDE like Code Blocks or Eclipse rather than Visual Studio.
You should try QT. It is pretty good framework for cross-platform development. The opensource version is free and very well maintained and has the LGPL license. That means you can sell your product as closed source but then you have to dynamically link to QT libraries.
You can use CMake. It will allow you to generate project/solution files for Visual Studio and Makefiles for Linux. This way, you can work using the native tool chain for a platform, while managing a single makefile. However, it's up to you to write portable code and to choose the appropriate libraries for your program to be truly portable.

Simultaneus development in Visual Studio and a Linux IDE

I am trying to get started with an existing open source project (QuantLib) using Linux operating system. However it seems that most developers use Visual Studio (judging from the project files committed with the source).
Which Linux C++ IDE would be most compatible with VS project files? Is there a way to import/export them, so that I don't have to create my own projects from scratch (and update them every time someone adds a new file)?
EDIT: Its all unmanaged code
In my experience, the best method for doing dual-development on Linux & Windows is to throw away the existing Visual Studio project files and, instead, use CMake to generate the platform-specific build environment. It's capable of outputting Nmake makefiles (for command-line Windows builds), Visual Studio projects, and Linux makefiles. The documentation leaves a bit to be desired but once you have it up and running, it's very easy to maintain.
The FAQ provides installation instructions for MinGW. It seems that there is a GNU Makefile included, so you don't need to mess with Visual Studio project files.
Aparantly they they only build on MAC and Windows.
Instructions here: http://quantlib.org/install/macosx.shtml
But since MAC is basically BSD Unix it should be identical (or with little trouble) to get it up and running on Linux.
The following should work (though you may need to look at the configure options)
1) Install Boost.
2) ./configure
3) make
You'll definitely want to check out Mono, it might be just what you're looking for: http://monodevelop.com/