At work we develop software that uses java7 and C++03, I would like to get my team to replace c++03 and instead embrace C++11. Can I assure them that every OS that runs java7 has also a gcc compiler for C++11?
I know the relation I make between java7 and c++11 is somewhat weird, but that's my way of saying we need to support some old OSes, but not that old that they don't run java7.
Thanks
It depends on whether you follow the sys specs for java 7 or not. There might be a way to force it to run on earlier versions of the mentioned OSs, but it is not officially specified so. take a look at the requirements:
Java 7 & 8 Sys Req
Now, for the listed OSs I am sure that GCC 4.7.2 is available (or it can be compiled). For windows, MS provides support for C++11 starting with VS 2010 which runs on Win XP or newer (if you don't like something like Cygwin).
The problem with all this is that it depends on how many C++11 features you actually need. For instance, Visual Studio 2010 doesn't support all C++11 features. Take a look at the following table to see what is supported in each compiler:
C++ compiler support
Related
I'm currently studying a book regarding C++, which is quite new. Therefore it also discusses C++11 in some parts. Having Windows Vista, I can't download the latest version of Visual Express, so I'll have to do with the 2010 version. This doesn't support C++11, so I'm currently wondering whether there exists a free alternative which does support C++11.
p.s. - Would you say it's essential/important for a beginner in programming to learn C++11 as well (instead of just the core basics)?
You could consider using virtual machine with a Linux flavor. I had the same problem as you, I installed VirtualBox, then Ubuntu having the latest g++ compiler
You could compile and use Clang on Windows Vista and integrate it to Visual Studio. They have an almost complete support for C++11 now (as of version 3.3).
I am trying to compile qt, and am faced with two choices whether use MinGw or Visual Studio compiler? What is the difference between them, and are there any advantages/disadvantages of using one or the other?
They are both fine tools. The important thing to know is that they don't necessarily play well together. That is, as you link libraries together, they must all use the same tool chain. For this reason, in my opinion, it is better to use the Visual Studio compiler (MSVC), as it is the "first class citizen" on Windows; the others are treated somewhat as second class.
What I mean is that you can pretty much count on third party libraries being available in binary form using MSVC, or at least build instructions being available using MSVC. We had lots of problems with third-party libraries not being able to build in MinGW or having nonexistent build instructions and having to do a lot of manual Makefile editing, etc. You are much more likely to have things "just work" if using MSVC.
That is just our experience (we started with MinGW); your mileage may vary.
MinGW uses GCC, and GCC has one significant advantage to MSVC - it is portable. MSVC is limited to Microsoft platforms, GCC supports pretty much everything, including 8bit embedded CPUs. Meaning that you can use the same directives and compile extensions across different platforms.
Also, MinGW is compact, quick to install, and a version is even bundled with Qt. Unlike MSVC, which is not even available standalone, you have to install visual studio, which itself installs a bunch of garbage you don't need but can't opt out of.
UPDATE
It is now possible to get the MS compiler without VS, a.k.a MS Build Tools. Also, If you want to build chromium (a.k.a the QtWebEngine) for windows you have to use MSVC, that's a limitation imposed by google, as they only support building with the platform-native compiler.
Last but not least, you can get MSYS2, which has a repository with MinGW and a ton of ready to use static and dynamic libraries build for it, so you can avoid the arduous and often failure prone build process.
UPDATE
Just for the sake of reference, for VS build tools 2019, the C++ compiler alone takes up about 4.5 gigabytes of space, or about 8 if you just click "C++ build tools" and leave it at the default. For comparison, GCC 9.x is about 150 mb. In fact, the MSVC compiler alone is larger than the entire extensive collection of packages that I adopted for use throughout the years, plus their dependencies, for a total of over 200 packages. Additionally, I'd say MSYS had packages for about 98% of the libraries and tools I've found myself in need of, and those remaining 2% include libraries it had but were not configured in a way, suitable for my use case. And it goes without saying, the packet manager makes it trivial to keep versions up to date.
What are the different platforms/languages in which an app can be compiled and run on Windows without any prerequisites? I know of .NET but it requires the specific version of .NET to be present in the Windows installation.
C and C++, but Visual Studio defaults to dynamically linked library. Change the default to static and you will be fine.
That being said, ther are no compilers that come with windows. You must install a compiler to build the a program that will run everywhere after that. There are free version of the compiler in the Platform SDK and in mingw (Cygwin requires a dll).
If you are using Visual C++ as language and development tool, you may switch to Statically bound DLLs, which would produce larger binaries, but would run without any runtime-prerequisites. Visual C++ Runtimes are easily installable, can be distributed, or users may be asked to install them directly. If users are using Windows Update, they would anyhow get the latest VC runtimes.
I would like to use C/C++ for coding my apps, but I need my apps running on all versions of Windows from XP to Win8, independently by any platforms, run time libraries and so on.
Briefly: What kind/type of C/C++ I suppose to use, be able to run my apps on every type of Windows without any additional installation, just default one. e.g Windows XP SP1
C++ can run on just about any OS, as long as you avoid (or, via conditional compilation, provide alternatives for) anything specific to one OS or version. Win32 code is almost all the same between versions; the main difference is added functionality in newer versions. Between Windows and, say Linux, though? Not so much. You kinda need to pick a platform, unless you want to either stick to text mode (which is pretty close between OSes, thanks to standards) or learn some whole other platform-neutral API like OpenGL, wxWidgets, GTK, etc.
As for which compiler to use, if you're sticking with Windows, I'd recommend Visual Studio. Microsoft has a free (Express) edition that will let you compile Win32 code or .net. (You'll need the paid version, or some playing around with the Platform SDK, to play with 64-bit though.) And the IDE isn't too bad either. If you just want a compiler, the Platform SDK has the same compilers VS has, and includes 64-bit support (and even a bunch of code samples and tools) as well.
As for being independent of any runtime libs: Every C++ compiler that's worth using has a runtime library. If you link statically against it, though, the parts you need will be embedded in your EXE. Alternatively, you have permission to distribute the runtime libs with your app (though you may need to install it via a package they provide, that you bundle together with your app...i forget how all that works).
All popular C++ compilers support XP up. You can statically link the runtime, or, for mingw, you can link against the runtime supplied with Windows.
I'm looking for a make system, along the lines of CMake or Bakefile, that supports the generation of Visual Studio project files and makefiles (targetting Linux) dual targeting x86 and x64 (in the same project/make file).
I've looked at CMake and Bakefile and they both appear to have limitations in this respect; they both appear to not support multiple targets (Bakefile doesn't even seem to support 64bit vcproj).
Are there any other tools, open source or paid, that may be suitable?
There's a (simple) patch for Bakefile that enables it -- you may be able to help with testing it.
Although it's a higher level tool and that you probably already know about it, I would propose SCons.
CMake can generate code multiple targets architectures (32 and 64 bit, say) on different platforms (win and linux, say). I can also use qmake (part of Qt) for this.