CMake Error Help

I can not run any program in CLion and this is what it says.

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/juliandolby/CLionProjects/untitled
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/usr/bin/cc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/juliandolby/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_bb17c/fast && xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.





CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/juliandolby/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/juliandolby/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".

[Previous CMake output restored: 3/22/21, 11:10 AM]

i posted on here yesterday and didnt really get anywhere but some people on discord tried to help me configure it but then got lost and I am still at a loss as to what to do
@jadolby7,
Are you rquired to use CLion for running programs? It looks to me like there's something wrong with your C compiler.

What OS do you have? From your output I'm guessing you mave macOS.

If so, try opening Terminal (if you aren't already using it) and use clang to compile your program.
Use this command:
c++ -std=c++2a -g -o exec program.cpp


c++: The clang C++ compiler in Terminal.
-std=c++2a: Flag that tells clang to compile as C++20 (the most recent version). Depending on what version of clang you have, you may be able to use -std=c++2b instead.
-g: Flag that tells clang to create a special file for debugging (you can remove this if you don't plan to debug).
-o exec: -o is a flag, exec is whatever you want to call your executable. You can remove this and it will default to call your executable "a.out".
program.cpp: The name of your program. If you're using a Mac, it might be .cc instead of .cpp.

To run your executable, enter
./exec
where exec is the name of your executable.

Good luck,
max
Last edited on
closed account (z05DSL3A)
Run Build Command(s):/usr/bin/make cmTC_bb17c/fast && xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.


Have you installed any dev tools? if not you should be able to get Command Line Tools from https://developer.apple.com/xcode/resources/
You need your Apple ID [Apple Developer Program membership is not required].
My MacBook died a while ago so can't help beyond that.
Grey Wolf,
He might not need to download it. I already have Comand Line Tools...I'm not sure if it was already on here or if the previous owner downloaded it (I bought my computer used).

jadolby7,
Try this command:
cd /Library/Developer/
(change directory to Developer)

Then enter
ls
(list files)

If it doesn't list "CommandLineTools," in the Developer directory, then you will need to download it.
Topic archived. No new replies allowed.