Is it possible to use different compiler versions in visual studio? - c++

There is a library (.lib, we don't have the source code) which we use to communicate with a hardware device which was compiled using
_MSC_VER 1600
I wish to use a newer c++ standard while using this library. When I change it to the next higher available in VS studio I get the message that 1600 does not match 1900. Is there a way to use a newer c++ standard and continue the use of the old library?
The company which provided the files hasn't updated the drivers in years.
I found on SE various answers to this topic but most are on expert level on c++ compilation/linking. I had problems to understand them.
EDIT: It is not a DLL but a .lib file. This may be explain wy I could not understand this question and answer. Another similar answer is this one: C++ MSC_VER mismatch with Third Party library
. Does this mean that the answer is "No, it is not possible. You have to use an old compiler version?"

Related

Windows programming using MinGW

Firstly, please forgive my ignorance regarding these matters, I have done a search and not found any comprehensive answers as of yet.
I plan on learning how to develop for Windows, however I am very fond of the GNU toolchain and don't really want to move onto using big environments like Visual Studio until I feel more comfortable with the underlying basics.
From what I understand, one can download the Windows SDK, which contains the headers and libraries needed to build native Windows applications.
Is the SDK literally just a collection of libraries and headers? If so, as my logic goes, it should be possible to point MinGW towards these libraries/headers, and simply build as normal.
When I build using Visual Studio, I can't see what preprocessor directives are being defined, what is being linked in etc. etc., as I am still learning, I like to be able to know exactly what is going on, preferably so I have to manually define, link etc. Hence the question.
So, what I want to know: is my logic correct?
Again, apologies if the question is rudimentary, I am still learning.
P.s. I am planning to develop Windows applications in a windows environment, this is not a question regarding cross-compilation.
Thanks!
MinGW is not compatible with the official Windows SDK, with one of the reasons
being that the SDK contains many VS-specific things (opposed to the GCC base
on MinGW). MinGW has adapted many of the necessary files, and for many programs
this is enough.
You don´t need to know the VS project settings for some program;
MinGW is still GCC in the core and used as such. If you can compile
programs with GCC on linux, learning how to use MinGW won´t be hard.
If you need functions/structures/etc. which are not yet part of it,
you´re out of luck, other than doing the adaption yourself, which
can be everything between very easy or very hard, depending on the case.
Additionally, proper thread usage is a bit quirky (has some "hidden" pitfalls,
which could go unnoticed in an actual program for years, but then...).
(While this is a disadvantage to VS, you´ll get C++11/14 (while VS hasn´t
even finished with 11, see link), better optimzation in many cases etc.)
If you´re choosing what exactly to download, look at WinGW-W64 instead of
the "original" old one. The original project somewhat stopped, has poor
lib support compared to W64, no 64bit compiler etc. (and don´t misunderstand
the "W64", it can be used for 32bit programs too)

How do I compile a directX tutorial sample in MingW

I have searched and searched and found no way to get directX to compile under MingW, I've seen others success and tried to replicate it to no avail. I've already read this similar question and it didn't help so please don't direct me to it: How to compile a DirectX 11 app in MinGW.
I've been trying to get MingW to cooperate with directX for a long time now, here is a list of my failed attempts and what I've read worked for others:
Download MSVC headers and have MingW use them
Download MingW-W64 and use it to compile
Download Reubens MingW-W64 and use it to compile
Download the most up to date MingW compiler and use it
Download TDM-GCC and use it.
mix compiler headers in a desperate attempt to make errors go away
I heard that I should be able to at least get to fail at the linker phase if I just dump the directX headers into the appropriate place, but I'm getting syntax errors left and right even after I did that (granted the bulk of them went away.) Each compiler ends up with its own unique errors, failing at different points but appearently succeeding in places where the others fail at some points. What is going on? Why does perfectly valid code (all written by microsoft) suddenly fail to compile when handled by any other compiler?
Unfortunately the samples include with the DirectX June 2010 SDK are far from "perfect valid code". They use a number of extensions specific to Microsoft's compiler.
Before I gave up on it as being essentially hopeless, I found the following Microsoft's specific dependencies when trying to compile the sample in Samples\C++\Direct3D\BasicHLSL:
the __noop intrinsic
the macros __min and __max
various "safe" versions of standard functions, like wsprintf_s and strcpy_s
non-standard pre-processor token pasting
allowing goto across variable initialization
the __uuidof operator
There are also problems with Microsoft's DirectX headers that I haven't mentioned, like being dependent on Microsoft's SAL annotation macros. Arguably though this a failing of MinGW for not having compatible versions of these DirectX headers.
Some of these problems are relatively easy to work around. Others are more difficult and would require rewriting the incompatible parts of the sample. There are also likely to be more Microsoft dependencies in the sample that I didn't discover.
The bottom line is that there's no way to compile the samples included with the DirectX SDK with MinGW or any other port of GCC without first modifying to the samples and the DXUT framework to make them more portable.

Intel's C++ compiler for Windows

It supposedly integrates with Visual Studio, but does it come with it's own C++ standard library? Or does it use the one provided by VC++?
At least the last time I checked, it used the one that came with VC++. I believe you can buy the Dinkumware library for it separately, if you really want to (but Dinkumware supplies Microsoft's library, so you're getting a different version of the same, not something radically different).

visual c++ and C++ builder

Can C++builder compile any c++ source files.
I don't have a good knowledge in c++. but i have some experience in delphi.
I like to use c++ but confused which one to use
I know that cbuilder has vcl , easy to develop ,easy for delphi developer
But my problem is can it compile any c++ files (vc++ and other source files).
is it compatible with vc++ (excluding MFC and VCL). Can i use any APIs with c++builder
You'll find C++ Builder very comfy coming from Delphi if you don't care about MFC or .NET via C++/CLI etc and just want native C++ then either will work for you. Visual Studio 2010 supports a lot of the new C++0x features which is pretty nice, although they don't have variadic templates yet. I'm not sure how much of C++0x is in C++ Builder as yet but that could be worth looking into as a deciding factor.
It should be able to compile any standards conforming code. If the code uses extensions that another compiler provides, it will more than likely have problems. VC++ has quite a few extensions that are on by default and so someone using that compiler might use them with out realizing what is going on(the same applies to G++ the other major C++ compiler out there.)
In my experience, C++Builder's support for more advanced C++ code is limited. For example, many of Boost's libraries are unsupported in C++Builder, and I've often had to modify other open source libraries to get them to build properly in C++Builder (due to various bugs or limitations in C++Builder's compiler). Simpler C++ code can work without any problems.
So, depending on what C++ libraries / source files / APIs you're wanting to use, getting them to work in C++Builder may be very straightforward, or it may take significant work.
You can download a free version of C++ Builder at www.embarcadero.com. With that, you can test your libraries for compatibility.

Cross compilation tutorials [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Cross platform programming
I've written some code using wxwidgets in c++. But I am not able to compile the same code for both windows and linux. Actually I'm a bit scared by the preprocessor directives generated by code-blocks ide. I wonder if anyone could point out some nice tutorials for learning cross-compilation.
Thanks in Advance
Jvc
If you want to build a cross platform program, you will stumbl across a few kind of problems.
Cross compilers problem
Some compilers are offering non-standard functionalities that might not work on other compiler. You have to make sure that compiler functionnalitie's you use are standard or available on all the compilers you use (An exemple would be the VC++ #pragma that wasn't usable on gcc until version 4.2.1)
Platform specific functions and libraries
Guess what, if you include <windows.h> it won't compile on a linux system (this is madness I know). So you must try to avoid those platform specific libraries/function. If you ever have to use them, try to encapsulate their use and select the specific class you need to compile on different system.
Here is a wonderful guide posted by the Mozilla foundation :
https://developer.mozilla.org/en/C___Portability_Guide
You could have a look at Cross Compiling wxWidgets Applications on Linux (Code::Blocks wiki) and Cross-Compiling Under Linux (wxWiki). There is also a section on cross compiling Windows applications in Brent W. Woodruff C++ Introduction to wxWidgets.