0

I am totally new to OpenGL and am following some beginners tutorials here

I followed the steps in the first tutorial very carefully and did exactly as described, but I got errors in CMake: no_cmake_c_compiler found and no_cmake_cxx_compiler found. I googled these errors but until now I couldn't find very clear steps to solve this issue.

So I decided to download the source code of the tutorials themselves and try to build them without CMake as new projects in VS Express 2015. However, I seem to be lost in the project configuration and also the including of the header and source files. Could someone please tell me how I should proceed to do this?

rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
Toni92
  • 27
  • 7

3 Answers3

0

You can simply tell cmake where the compilers are. When you click on configure for the first time you will see a dialog where you can select a generator. You first pick the generator for your Visual Studio Version. Second you select "Specify native compilers" and then hit next. In the following dialog you need to browse for the C and C++ Compilers. Select "C:\Program Files (x86)\Microsoft Visual Studio \VC\bin\cl.exe" for both. (Be careful if file endings are hidden on your machine. There is a file called cl.exe.config as well.)

Click finish and it should work.

David Marquant
  • 2,039
  • 14
  • 12
  • Thanks for answering. I tried this but this time got the error: cl.exe is not able to compile a simple test program. I searched for solutions and tried the 2 suggested here: http://stackoverflow.com/questions/14590947/cmake-configuring-fails-cl-exe-is-not-able-to-compile-a-simple-test-program but unfortunately none of them worked. (As for the second one I uninstalled .NET 4.6 which I had, but it seems to still be there, because it didn't let me install 4.0, it said I have a newer version) – Toni92 Jan 11 '16 at 20:50
  • BTW I actually choose the generator for VS 2014,because it has only the options either 2012 or 2014,not 2015. – Toni92 Jan 11 '16 at 21:07
  • The correct generator is called 'Visual Studio 14 2015'. What version of cmake are you using? – David Marquant Jan 11 '16 at 21:42
  • Yes, I choose Visual Studio 14 2015 Win64 (because my Windows is 64 bit). The CMake version is 3.4.1. – Toni92 Jan 15 '16 at 18:16
  • Hm, ok I tried with cmake 3.4.1 now and still everything is fine. You need to provide more information. What is the exact output cmake is giving you? Do you need to use Visual Studio and msvc compiler? – David Marquant Jan 15 '16 at 21:26
  • Please see the below anser. I added it like a new answer, not a comment, because I don't know if I can edit the text layout in the comment field... – Toni92 Jan 16 '16 at 12:49
0

Update: After trying with CMake 3.4.2 the Output is:

To me it looks better now, but when I get to the folder with the binaries, there is no Tutorials.sln file there.

The C compiler identification is MSVC 19.0.23506.0
The CXX compiler identification is MSVC 19.0.23506.0
Check for working C compiler using: Visual Studio 14 2015 Win64
Check for working C compiler using: Visual Studio 14 2015 Win64 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 14 2015 Win64
Check for working CXX compiler using: Visual Studio 14 2015 Win64 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Found OpenGL: opengl32  
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE  
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
Using Win32 for window creation
Using WGL for context creation
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of off64_t
Check size of off64_t - failed
Looking for fseeko
Looking for fseeko - not found
Looking for unistd.h
Looking for unistd.h - not found
Configuring done

--------------------------------------------
--------------------------------------------
*Older:* This is what I get from CMake as Output:



> The C compiler identification is unknown The CXX compiler
> identification is unknown Check for working C compiler using: Visual
> Studio 14 2015 Win64 Check for working C compiler using: Visual Studio
> 14 2015 Win64 -- broken CMake Error at C:/Program Files
> (x86)/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61
> (message):   The C compiler "C:/Program Files (x86)/Microsoft Visual
> Studio
>   14.0/VC/bin/cl.exe" is not able to compile a simple test program.
> 
>   It fails with the following output:
> 
>    Change Dir: C:/Users/Antonia/CMakeBuild/CMakeFiles/CMakeTmp
> 
>   
> 
>   Run Build Command:"C:/Program Files
> (x86)/MSBuild/14.0/bin/MSBuild.exe"   "cmTC_f5d7b.vcxproj"
> "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
> 
>   Microsoft (R) Build Engine version 14.0.24723.2
> 
> 
>   Copyright (C) Microsoft Corporation.  All rights reserved.
> 
> 
>   
> 
> 
>   Build started 16.1.2016 �.  14:41:13.
> 
> 
>   The target "BeforeGenerateProjectPriFile" listed in a BeforeTargets 
> attribute at "C:\Program Files  
> (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets (186,61)" does
> not   exist in the project, and will be ignored.
> 
> 
>   Project  
> "C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\cmTC_f5d7b.vcxproj"
> on   node 1 (default targets).
> 
> 
>   PrepareForBuild:
> 
> 
>     Creating directory "cmTC_f5d7b.dir\Debug\".
> 
>     Creating directory "C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\Debug\".
> 
>     Creating directory "cmTC_f5d7b.dir\Debug\cmTC_f5d7b.tlog\".
> 
> 
>   InitializeBuildStatus:
> 
> 
>     Creating "cmTC_f5d7b.dir\Debug\cmTC_f5d7b.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
> 
> 
>   ClCompile:
> 
> 
>     C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /W1 /WX- /O2 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t
> /Zc:forScope /Zc:inline /Fo"cmTC_f5d7b.dir\Debug\\"
> /Fd"cmTC_f5d7b.dir\Debug\vc140.pdb" /Gd /TC /errorReport:queue
> C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\testCCompiler.c
> 
>     Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
> 
>     Copyright (C) Microsoft Corporation.  All rights reserved.
> 
>     
> 
>     cl /c /W1 /WX- /O2 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline
> /Fo"cmTC_f5d7b.dir\Debug\\" /Fd"cmTC_f5d7b.dir\Debug\vc140.pdb" /Gd
> /TC /errorReport:queue
> C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\testCCompiler.c
> 
>     
> 
>     testCCompiler.c
> 
> 
>   Link:
> 
> 
>     C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\Debug\cmTC_f5d7b.exe"
> /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTUAC:"level='asInvoker'
> uiAccess='false'" /manifest:embed
> /PDB:"C:/Users/Antonia/CMakeBuild/CMakeFiles/CMakeTmp/Debug/cmTC_f5d7b.pdb"
> /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT
> /IMPLIB:"C:/Users/Antonia/CMakeBuild/CMakeFiles/CMakeTmp/Debug/cmTC_f5d7b.lib"
> /MACHINE:X64 cmTC_f5d7b.dir\Debug\testCCompiler.obj
> 
> 
>   LINK : fatal error LNK1104: cannot open file 'kernel32.lib'  
> [C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\cmTC_f5d7b.vcxproj]
> 
> 
>   Done Building Project  
> "C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\cmTC_f5d7b.vcxproj"  
> (default targets) -- FAILED.
> 
> 
>   
> 
> 
>   Build FAILED.
> 
> 
>   
> 
> 
>   "C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\cmTC_f5d7b.vcxproj"
> (default target) (1) ->
> 
> 
>   (Link target) -> 
> 
> 
>     LINK : fatal error LNK1104: cannot open file 'kernel32.lib' [C:\Users\Antonia\CMakeBuild\CMakeFiles\CMakeTmp\cmTC_f5d7b.vcxproj]
> 
> 
>   
> 
> 
>       0 Warning(s)
> 
>       1 Error(s)
> 
> 
>   
> 
> 
>   Time Elapsed 00:00:00.81
> 
> 
>   
> 
>   
> 
>   CMake will not be able to correctly generate this project. Call
> Stack (most recent call first):   CMakeLists.txt:3 (project)
> 
> 
> Configuring incomplete, errors occurred! See also
> "C:/Users/Antonia/CMakeBuild/CMakeFiles/CMakeOutput.log". See also
> "C:/Users/Antonia/CMakeBuild/CMakeFiles/CMakeError.log".
Toni92
  • 27
  • 7
  • Ok it seems like you are missing the proper windows sdk... So which version of VS 2015 did you install? There is for Desktop, for Windows and there is the community edition (which I have). – David Marquant Jan 16 '16 at 13:10
  • I installed Visual Studio Express 2015 Community. And I start it from Microsoft Blend for Visual Studio 2015, its version is 14.0.24720.00 Update 1. The .NET framework is 4.6.01055 – Toni92 Jan 19 '16 at 18:04
  • Try CMAke 3.4.2, maybe it's an already fixed bug: https://cmake.org/Bug/view.php?id=15831 – usr1234567 Jan 20 '16 at 07:10
  • Thank you for this suggestion. Please find updated info in the answer above. – Toni92 Jan 21 '16 at 20:57
0

I found what was the mistake when trying with the new version (3.4.2) - I had missed to click Generate after Configuring... Now I have the projects and the source file in VS. Thank you very much for suggesting that I try with CMake 3.4.2 :)

Toni92
  • 27
  • 7