1

Can someone help me set up compiler for CMake and thus help me understand how all this works? I intend to use point cloud library, but I'll use more simple example here (which is also not working) so I could explain my problem better.

I have next components:

  • Visual Studio 10 (C:\Program Files (x86)\Microsoft Visual Studio 10.0)
  • CMake 3.7.2 (C:\Program Files\CMake)
  • "hellocmake" project - complete file structure as presented here (C:\Users\my_name\Documents\Visual Studio 2010\Projects\hellocmake)

I tried to run CMake Gui, pointed to a source and build folders, configured for "Visual Studio 10 2010 Win 64" and run out as expected with:

"The C compiler identification is unknown The CXX compiler identification is unknown"

I understand I need to setup compiler, but I'm not sure at this point what should I do. I tried so far:

  • From visual studio open command prompt, navigate to CMake and run "cmake -D CMAKE_CXX_COMPILER="g++" CMAKE_CC_COMPILER="gcc"

Output: "The C compiler identification is unknown. The CXX compiler identification is unknown. No CMAKE_C_COMPILER could be found" g++ was not a full path and was not found in PATH

  • I added C:\Program Files\CMake\bin and C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe to Environment Variables -> PATH and tried all again. I have the same output as above.

  • Putted these lines in CMakeLists.txt inside C:\Program Files\CMake:

SET(CMAKE_C_COMPILER C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe) SET(CMAKE_CXX_COMPILER C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe)

and ended up with the same "No CMAKE_C_COMPILER could be found" output.

Also tried to put a quotes for CMAKE_C_COMPILER path, to use CMAKE_CXX_COMPILER:PATH in command prompt, to run CMake Gui as admin and nothing works.

I really don't know what to try more now. Also, I'm not sure how all this work after so many unsuccessful trials.

Any help will be highly appreciated. Thanks!

EDIT:

enter image description here

30114
  • 161
  • 1
  • 1
  • 14
  • have you cleaned the build dir from the CMake configuration generated files between every solution you tried? – fedepad Jan 22 '17 at 19:57
  • and check this SO post: http://stackoverflow.com/questions/32801638/cmake-error-at-cmakelists-txt30-project-no-cmake-c-compiler-could-be-found – fedepad Jan 22 '17 at 19:59
  • Please try to always give the complete, absolute path (instead of g++) and to quote the argument (Program Files is otherwise treated as two elements of a list). – usr1234567 Jan 22 '17 at 21:46
  • Normally Visual Studio finds its own compiler automatically. Are you sure, that your installation of Visual Studio is 64-bit one? It is installed under `C:/Program Files (x86)`, where normally 32-bit programs are installed. – Tsyvarev Jan 23 '17 at 07:23
  • Does your Visual Studio work without CMake? Just to verify your VS installation. If none of the already suggested things work, can you please verify again that your VS does not need any administrator privileges? – Florian Jan 23 '17 at 08:43
  • I tried all the above options and reinstalled the Visual Studio 2010 again. I installed 64-bit version, but my installation is still under C:/Program Files (x86). I navigated form VS command prompt and used full path like this: cmake -D CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 10/VC/bin/cl.exe. I'm getting some errors now that I don't understand. Please see attached picture. If someone understands where my mistakes are, please lmk. Additionally, trying to run simple c++ sln (Ship_Destroyer_Game) from the samples page and resulted with fatal error LNK1123 – 30114 Jan 23 '17 at 21:01

0 Answers0