Is there any way to make Google testing framework work with Visual Studio 6? - c++

I tried to follow this question and answers but have gotten lots of compilation errors like this.
error C2182: '__formal' : illegal use of type 'void'
Is there anybody who is successfully using VS 6.0 with Google Testing?

Some time ago, someone proposed a patch for Google Test to support VC6. That patch was ultimately rejected in the trunk because it made it harder to support the library. But the patched source was put in a branch in Subversion for people who need it. There it sits, unsupported.
But because it's not supported, there has been no backports from the trunk since it was branched at version 1.3. But if you really need it and don't mind missing all the features added since then, you can grab it from there.

Probably not. VS 6.0 isn't compatible with C++03, so not much C++ will work on it. You'll most likely need at least VS 7.1 (2003) or VS 8.0 (2005).

Related

Is MSVC 2010 a C++11-standard-compliant compiler

I was about to use google test for unit testing our MSVC 2010 based project, but the README.md file of the gtest v1.10.x branch (the current latest) mentions a C++11-standard-compliant compiler in the Build Requirements section.
So is MSVC 2010 a C++11-standard-compliant compiler, or should I rather use gtest v1.7.0 which mentions Microsoft Visual C++ 7.1 or newer in the Windows Requirements section?
Around 2017, we had been facing too many random crashes with apps built using MSVC10 & MSVC11 compilers. Upon analyzing this, we identified that the standard C++ library calls were the cause for the crashes though we did nothing wrong, and the code was perfectly written.
After some struggle debugging and study, we identified that Microsoft's C++11 implementation was non standard and buggy, and caused unnecessary crashes. For us, even the basic wait_for call on condition_variable had random crashes. Here is one such MSDN reference for you.
We contacted Microsoft regarding this, and their reply was,
"I'm sorry, but no hotfixes for this bug are available. I strongly
recommend upgrading to the latest released version of VS (currently VS
2017 15.4), as we have fixed many bugs in the STL's multithreading
machinery over the years."
We had to move all our projects to VS2017 (The latest one at that time) to get rid of the crashes. I wouldn't recommend you using those buggy compilers either.
Better stick to older compilers(VC8/VC9) or move to the latest one (VS2019). We had no issues after migrating to VS2017.
No, MSVC 2010 is not fully C++11 compliant. However, it does provide many C++11 features. You could try and compile the latest google_test with it, or just use an older version.

State of module support in VS 2017

Regarding Visual Studio 2017's C++ module support -- Is the support good enough such that developers can start converting their code bases to use modules?
I'm interested in refactoring my toy game engine to use modules. I've been reading conflicting info, online, about the status of this feature in VS2017, so I don't want to embark on the change if the feature is buggy or incomplete.
My main motivation for switching to modules is to do away with god damn header files.
I went ahead and tried some tests for adding modules. Nope, this is not, at all, ready. I can't even get the simplest program to compile in the IDE. I have the lastest version (15.9.3, as of this writing).
This is one of the tutorials I tried, for example:
https://blogs.msdn.microsoft.com/vcblog/2017/05/05/cpp-modules-in-visual-studio-2017/

Compiling gRPC using MSYS2/Mingw32

I've come across an issue whilst trying to compile the latest branch of grpc under MSYS2, using mingw64 as suggested by the official installation guide.
The latest gcc for msys2 is 5.2.0, which isn't exactly on good terms with grpc. Still, downgrading to 4.9.1 helped a bit. Through a lot of manual editing of the makefile and a couple C headers, I was finally able to compile all the dependencies. As far as I can tell, most objects had successfully compiled. However, make keeps failing with the error "no target to make libgrp.dll, required by shared_c"(might not be perfect wording). I end up with botched static libs that are recognized by Qt as lacking symbols.
I would greatly appreciate a reliable compilation guide for grpc, and/or precompiled binaries fit for Qt 5.5 32-bit. I know the project is not too mature just yet, but it looks very promising and I can't wait to work with it!
Many thanks!
You're right that mingw isn't quite a first class citizen for grpc, but it's something we're looking to work on soon. Please file bugs at http://github.com/grpc/grpc/issues for anything you find!
That said, we do test the C codebase against Visual Studio 2013 regularly. I expect C++ to be tested regularly soon, along with VS2015. Could VS2015 be the solution to your problems, given it's now a free download?

Is there a way to install a newer compiler to an older version IDE (VS 2012)?

I just started learning C++ very recently. The IDE that I am currently using is Visual Studio 2012 which I used to code in C previously, but the compiler that comes with it lacks support for C++11. Plus, the place I am in has limited internet access, so its kind of a pain to install a new IDE (VS 2015 Community is out btw). So is there a way to keep the old IDE and instead just update the compiler in it to use the new standards? I have a feeling that we can't do that, or else they can't sell their new products but I just wanted to be sure. Thanks.
The compiler and IDE can, to some degree, be used separately, but I can't imagine that procuring and installing one and not the other is going to be anything other than a headache. If nothing else, you will likely spend more time and resources in doing so rather than just procuring the full suite in the first place. I suggest waiting until you are in a different place.
If it makes you feel any better, C++11 support in more recent versions isn't substantially improved anyway.
Yes. You can upgrade the compiler using the same IDE. IDE doesn't compile the code, and with time, has to upgrade the compiler standards.
For c++ latest compilers for your IDE, check out this link
Hope it helps.
PS- I'm using eclipse for programming in Java, c and c++. I have installed different compiler versions and use as required by the source code. IDE gives you the option to compile your code with of the installed versions of compiler.

C++11 on Windows

I'm wondering how well writing software in C++11 works on Windows yet. It would be most comfortable (and propably most natural) to use one of the native compilers for Windows - I'm thinking about Visual Studio 2012 Express or Visual Studio 2013 Express here. Everything I could find so far on that matter is
http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
(Comparison of C++11 features of VC10 and VC11, which seems to be quite bad)
http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx (not really transparent, didn't give me a good idea how well it works)
Does anyone have any experience how well the current Visual Studio versions can handle C++11? I really want to start using auto, lambdas, variadic templates, template aliases, initializer lists and rvalue references (to name just a few) and all the other good stuff right now, but if Windows might be a problem I might have to use C++03 further.
Another possibility seems to be to install LLVM and Clang on Windows. My primary platform is OSX, and on that system Clang's support for C++11 is really good. But I read that the LLVM-version of the standard library for C++ (libc++) does not work well on Windows. So LLVM/clang might not be an option.
What are your opinions on C++11 development on Windows?
Thank you!
I can only give you my experience as a developer, as I've been building against the cutting edge of C++ on Windows using Visual C++ for just about everything, while also installing several other compilers and IDEs (including building Clang myself on Windows for Visual Studio 2012, 2012 CTP, and 2013 Preview). The following is my experience up until right now (August 13th, 2013), and is based on Herb Sutter's talk and working with the compiler every day.
The Quick
Run in the opposite direction of Visual Studio / VC++. Support for C++11 is slow, and they're currently being crushed in terms of compiler features versus Clang and GCC.
The Present
Visual C++'s C++11 (and C++14 support) is beyond abysmal right now. They lack powerful features that make template metaprogramming in C++ great (using expressions in particular).
Using doesn't exist right now. I have spent hours and hours porting great C++11 code with using to VC++, only to have it break it certain places, snap, or just become near damn unmaintainable.
Variadic support in the CTP was horrifically terrible, and while it got better for Visual Studio 2013 Preview's version of the compiler, it's still fairly bad at complex variadic and template expressions that obey the standard (and compile fine in GCC and Clang).
=delete and =default are pretty much gone from VC++ right now; in the hopeful near future, maybe it will work out (and it should come "soon-ish", according to the roadmap) (I had to implement r-value constructors explicitly for many simple classes all the way down a 8-class inheritance hierarchy once. It was the worst slap in the face, when I watched GCC and Clang users get all of my explicit hardcoded work for free with =default).
As a holdover (primarily because of Windows OS code and some binary compatabilities), Empty-Base-Class-Optomizations in VC++ don't work. Don't expect your class hierarchy sizes or member layout to be optimized in the least (watch your ordering in std::tuple when packing variable types).
This is about all the frustrations I've come into contact with so far. They're work-aroundable -- I have to work with them every day -- but if you want great C++ support, you should jump for GCC or Clang and somehow make it work on your machine.
The Future
If you really want C++11, you will need to wait about a year, and even then Visual Studio 2013's release of VC++ will still be missing a few features (and don't expect them to be bugless either). VC++ for 2013 will also still be critically missing std::move and explicit r-value support in many places, making it painful when you expect things to work.
The Caveat
If you're not a powerful Vim user, you're low on options when it comes to IDEs that you can work with (that play nice with GDB/GCC or Clang).
QtCreator is nice, works with MinGW, and is generally fully featured enough to get work done.
Sublime Text can be used, but you'll have to write your own building system or delegate that to something else.
Code::Blocks's autocomplete is wonky and behaves strangely, and the IDE itself feels clunky.
Eclipse is supposed to be good, but my experiences with it are clunky and strange, with odd input lags at time (despite a 8.00 GB i7 Haswell machine using an SSD).
Visual Studio, as an IDE, is pretty solid. Then stack Visual Assist X on top, and it works pretty damn well for C++ coding. It's really the only reason I continue to stick with it, but I've already made headway into learning Vim so I can mostly ditch Visual Studio altogether, when the time comes.
About Libraries
Library support in VC++ is pretty complete (for as much as their broken compiler lets them be complete). It has regex, while most other libraries have non-existent or broken regex support. But that doesn't mean that the VC++ library plays nice with some C++11 features that it says it does (picture by melak47).
And Lastly
If you want code that you know is going to work in Windows, 100%, for the rest of eternity, you'll probably want to program against VC++. The other "benefit" is that the code you write in VC++ is the smallest subset of C++/C++11 you can write with, so in the end it should compile everywhere. Of course, that goes against the very idea of using beautiful C++11 and enjoying it, so... pick your poison(s) wisely.
VC's C++11 support is far from complete, but it does include the most important user-facing features.
And here's the other thing. In my experience, it is fine to install MinGW or Clang on Windows, but you're going to have some inconvenience because hardly anybody precompiles binaries for those compilers for Windows (whereas lots of people precompile binaries for Visual Studio).
In addition, there are as far as I am aware no environments for Windows which are remotely as advanced as Visual Studio for things like graphical debugging, intellisense, and stuff like that. When I tried Code::Blocks it just didn't work, realistically.
You can see here for a comprehensive comparison of compiler support for C++11 language features. Here's some info on VS's C++11/14 roadmap.
MSVC is lagging behind the other major C++ compilers but it's still got support for many of the most important features.
auto, lambdas, and rvalue references are available from VS10. IIRC there's a caveat with rvalue references that the compiler doesn't generate move construction and move assignment operators.
variadic templates and initializer lists are available in the VS2013 preview, including library support.
type aliasing (i.e., typedefs with the using keyword) is expected to be available in VS 2013 RTM.
If you don't need to interoperate with binaries generated by VS then installing another compiler such as GCC is workable. I understand Clang can also work in a mingw environment, with libstdc++ rather than libc++.
http://nuwen.net/mingw.html
The nuwen distro is AWESOME! It is MinGW but it comes out much quicker than MinGW as new GCC releases come out. It also comes with all of boost and other useful libraries already compiled. It is all I use on windows anymore.
We are using C++11 for a few months already in production software across windows and linux in some here.com products without any problems. We use auto, lambdas, range for... Using Visual studio 2012 and gcc 4.7.
I have been using VS2012 and used C++11 features where possible. There are some bugs in the implementations and I have found it helpful to have another compiler to hand when I get errors from Visual Studio to compare against.
Clang and GCC to lead the way in terms of C++11 feature support and it appears to be a neck-and-neck race in terms of C++11 support between the two. MSVC is sadly panting trying to keep up and lagging behind. The Nuwen MingGW distro is, as Jake mentions, excellent and appears to be working well with Eclipse (Kepler release) and I didn't encounter too much pain using it with Netbeans 7.4 either. The Nuwen distro is currently at version 11.2 at the time of writing and, as you can see at Stephan's website, is now x64-native, featuring GCC 4.8.1 and Boost 1.54.0, with GCC's default mode also set to C++11.
I'm certainly beginning to use Eclipse Kepler and Nuwen MinGW in preference to MSVC 2012 more and more, but I'm largely a hobbyist C++ programmer still getting my feet wet and may not have hit the more obscure problems that those to whom C++ is their bread and butter may know about.