VS2010 C and C++ - enforce ANSI compliance for Linux/gcc compatibility? - visual-studio-2010

I'm taking a class in which I'm required to write some C++ apps for Linux. I really, really dislike the dev tools available under Linux, but I love VS2010.
Is there any sort of compiler switch which will enforce ANSI or gcc compatibility in VC++? Or can I swap the compiler out for gcc and still use the VS environment?

You can disable Microsoft extensions to the ANSI C and ANSI C++ standards by specifying the /Za flag, which will make the compiler emit errors if you use non-standard C and C++ features.
http://msdn.microsoft.com/en-us/library/0k0w269d(v=VS.100).aspx
However, this doesn't preclude you from using platform specific headers.

This blog post seems to discuss something similar to what you're after.
I can't seem to find better info than this MSDN document regarding VS2010 ANSI compatibility.
Some alternatives to VS2010 include MonoDevelop - which supports C#, VB.Net, C/C++.
There's also Eclipse IDE for C/C++ Dev.
This stackoverflow question may also be of use.

Related

How can I inspect variable values while debugging MSVC ABI Rust programs?

I've downloaded the MSVC ABI version of Rust 1.7.0 and followed the guessing game section from the docs.
I notice that the builds use the native toolchain (Visual Studio 2015 Update 2 in my case) and therefore generate native PDBs (debugging symbols) consumable by native debuggers, such as WinDBG, CDB or the Visual Studio debugger. I can easily set breakpoints, step into standard library source and so on.
What I cannot do is to inspect variable values. Regardless of the debugger used, the 'Locals' display is empty.
From what I can gather, the Visual Rust/RustDT IDEs display locals when using GDB or LLDB as a backend, not the native Windows debugging engine. I'm not entirely sure if I can use these to debug Rust programs compiled for MSVC ABI (with PDBs and so on).
If I want to have the necessary debugging experience, is my only option to switch to the GNU ABI? Barring that, is there an easy way to map to Rust symbols (variable values) from the raw debugging tools (registers, memory map)?
Features don't exist until they're implemented. Rust is built upon LLVM and full PDB support has only recently been considered for LLVM. For now LLVM has only a limited PDB support, with the limitations best described on the Clang project's MSVC compatibility page. In my opinion, it's best to wait until the support is there, although for other programming languages interesting workarounds have been implemented.

I am using CLION w/ MinGW 3.2, is this ideal for C++11?

I am a student but this is a more general question and not related to any HW
I am using CLION with MinGW 3.2 and CMake 3.2.2 Is this ideal for C++11? Or better phrased is this at minimum compatible and will not crash for most C++11 features?
A lot of my classmates are having issues compiling or getting crashes, my instructor suggested due to many of them not using the class recommended IDE (Visual Studio) and default compiler that it may be because their compiler is not C++11 compatible.
We have not used many C++11 features-in fact the only one we have used so far is auto. (I did some searching before and found that this was a C++11 new feature, is this correct?). Should I be worried about any compatibility issues with my given environment (MinGW 3.2 - CLION uses GCC 32 only last I checked) and CMake (ver 3.2.2)?
Also is CLION a good IDE in general? I have access to VS2013 for a year though I use a WebStorm and PyCharm for other classes and personal projects so I thought I'd stick in the JetBrains family and use CLION.

Windows Qt with MinGw or Visual Studios?

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.

Ada with Visual studio

I'm just starting to learn Ada and was wondering if an editor like MVS 2008/2010 can be used? Will MVS detect the GNAT compiler? I have the GNAT GPL compiler but find the GPS editor hard to use (much less intuitive than the MVS editor). The tutorial doesn't explain well how to create a project in GPS.
I'm currently using AdaGIDE which works well, though it's limited in features.
Thanks.
I haven't ever seen any VS addon for Gnat. It would be tough to do for vanilla Gnat, as it isn't compatible with the Microsoft linker. This is more of a gcc vs. Microsoft thing. There is a Gnat .NET port, which claims to integrate well with the Microsoft tools (including VisualStudio). You may have better luck with that.
The other option you have is ObjectAda. It doesn't use VisualStudio either, but it uses an environment designed to be familiar to VS users. It isn't free, but last I checked its cost was comparable to VisualC++'s. It does use the Microsoft linker, so integrating it with VisualStudio should be doable.
Personally I loathe VisualStudio, and do all my editing in Emacs (Even for Microsoft C++ work), but I can see where you are coming from.
VisualAda isn't released yet, but when it is eventually, it will not only integrate GNAT with Visual Studio, but also automatically generate Ada bindings for WinRT components รก la what C++/WinRT does for C++. Here is a video and here is a posting on comp.lang.ada of a demo of the unreleased VisualAda.
Finally, we got "Visual Ada" plugin by Alex Gamper:
https://marketplace.visualstudio.com/items?itemName=AlexGamper.VisualAda
As stated by many others, the add-on is based on gcc/gnat (with all that mingw/msys2 infrastructure) and still not native for VS

GNU CC and Windows

I'm a bit confused about the options for using GNU CC on Windows.
If I want to primarily develop console applications (as opposed to GUI apps) what do I need? Where do Cygwin and MinGW figure? For example, if I use the NetBeans IDE C/C++ option, that requires installation of Cygwin.
Are there any options which would allow Console application development without Cygwin?
Both MinGW & Cygwin give you the gcc compiler but if you use MinGW you don't need to install Cygwin because it uses native Windows libraries rather than Cygwin libraries
Cygwin is more than just compilers, it tries to provide a UNIX programming environment by building a lot of UNIX libraries on top of Windows SDK.
You could install CodeBlocks IDE oder DevCPP ide. If you do not require special posix api's then you do not need to install cygwin.
You really really should check out Visual C++ Express. It makes developing on windows A LOT easier. I it is free and the Visual C++ is the preferred way to develop windows apps. ANd yes, you can make console applications too.
That clarifies things. I'm not particularly interested in a *nix-like environment. I was more interested in getting a GNU C compiler that conforms closely with C99 (which I believe the latest GCC compiler does) and using it as a C learning exercise (hence console rather than GUI apps)
It appears to me that NetBeans IDE/Cygwin option installs an earlier version of the compiler.
So, it appears that MinGW is what I am looking for if I want to use GNU C. Incidentally, the free Pelles C compiler/IDE has a very full C99 implementation.
You can use vc express for concole apps if you wish, or really any compiler for win platform.
MinGW can support many languages as well as GNU C Compiler. It also comes with msys package that you can simulate UNIX environment. Cygwin does the same thing as msys does. I'd advice you to install MinGW with full msys support.

Resources