Unable to Compile a Simple Test Program

已回答

I just dual booted Linux and installed CLion to begin my first C++ program but I am getting this error upon starting a new program (all it is is the default Hello World print):

 

I'm unsure what I must do to fix it... Thank you

 

/home/jacob/Desktop/clion-2018.2.2/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/jacob/CLionProjects/350Project1
-- The C compiler identification is GNU 7.3.0
-- 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 /home/jacob/Desktop/clion-2018.2.2/bin/cmake/linux/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

"/usr/bin/cc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/jacob/CLionProjects/350Project1/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_12926/fast"
/usr/bin/make -f CMakeFiles/cmTC_12926.dir/build.make CMakeFiles/cmTC_12926.dir/build
make[1]: Entering directory '/home/jacob/CLionProjects/350Project1/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_12926.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTC_12926.dir/testCCompiler.c.o -c /home/jacob/CLionProjects/350Project1/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_12926
/home/jacob/Desktop/clion-2018.2.2/bin/cmake/linux/bin/cmake -E cmake_link_script CMakeFiles/cmTC_12926.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_12926.dir/testCCompiler.c.o -o cmTC_12926
/usr/bin/x86_64-linux-gnu-ld: cannot find Scrt1.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_12926.dir/build.make:86: recipe for target 'cmTC_12926' failed
make[1]: *** [cmTC_12926] Error 1
make[1]: Leaving directory '/home/jacob/CLionProjects/350Project1/cmake-build-debug/CMakeFiles/CMakeTmp'
Makefile:121: recipe for target 'cmTC_12926/fast' failed
make: *** [cmTC_12926/fast] Error 2

 

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


CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/home/jacob/CLionProjects/350Project1/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/home/jacob/CLionProjects/350Project1/cmake-build-debug/CMakeFiles/CMakeError.log".

[Finished]

0

Hi! Could you please try solutions from this stackoverflow article?

0
Avatar
Permanently deleted user

sudo apt install --reinstall build-essential

fixed it for me.

0

请先登录再写评论。