Visual Studio compilers not visible by cmake

1.5k views Asked by At

I'm trying to build a program in c++ using mysql.h

So i read that compiling with cmake is necessary. But as it seems cmake cant find visual's studio compilers even though I opened it through Developers command prompt.
This is the error that occurs:

The C compiler identification is unknown

The CXX compiler identification is unknown

CMake Error in CMakeLists.txt: No CMAKE_C_COMPILER could be found.

CMake Error in CMakeLists.txt: No CMAKE_CXX_COMPILER could be found.

Also, at cmake error list, it says :

Build started 22/12/2016 00:28:42.

The target "_ConvertPdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,37)" does not exist in the project, and will be ignored.

The target "_CollectPdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,70)" does not exist in the project, and will be ignored.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform‌​.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

1

There are 1 answers

0
drescherjm On BEST ANSWER

From the comments. The problem was caused by using the wrong generator for Visual Studio 2015.

The correct generator for 32 bit code in Visual Studio 2015 is Visual Studio 14 2015 and for 64 bit code it is Visual Studio 14 2015 Win64.