This problem is related to GCC and CMake.
My original CMakeLists.txt is
cmake_minimum_required (VERSION 3.22.1)
project (Transformation)
find_package(Eigen3 REQUIRED)
include_directories(EIGEN3_INCLUDE_DIR)
add_executable (Transformation main.cpp)
The error result is
[cmake] -- The C compiler identification is unknown
[cmake] -- The CXX compiler identification is AppleClang 13.0.0.13000029
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake] The CMAKE_C_COMPILER:
[cmake]
[cmake] /usr/local/bin/x86_64-apple-darwin20-gcc-11.1.0
[cmake]
[cmake] is not a full path to an existing compiler tool.
[cmake]
[cmake] Tell CMake where to find the compiler by setting either the environment
[cmake] variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
[cmake] the compiler, or to the compiler name if it is in the PATH.
I have to set the path by myself. Then It builds successfully.
set(CMAKE_C_COMPILER "/usr/local/bin/x86_64-apple-darwin21-gcc-11")
Why is the default compiler in original situation x86_64-apple-darwin20-gcc-11 .1.0? I don't have this file in /usr/local/bin. My gcc version is 11.2.0 and its name should be x86_64-apple-darwin21-gcc-11.
(I've checked the relevant problem on "The CMAKE_C_COMPILER is not a full path to an existing compiler tool" How to find compiler path automatically in cmake? but it seems not my situation)
This is my first time using CMake and gcc. I would be grateful if someone could help me(⑉꒦ິ^꒦ິ⑉). Many thanks!!!