0

This is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.17)
project(fms C)

set(CMAKE_C_STANDARD 99)

add_executable(fms main.c fms.c fms.h fms_data.c)

target_link_libraries(fms m)

The following is one of the compiler errors:

C:\Users\Holland\CLionProjects\fms\fms.c(27): error C2065: "M_PI": nichtdeklarierter Bezeichner

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • Are you linking the math library also? with a GCC toolchain, you usually need to add `-lm` to link `ibm` which is the math library. – Morten Jensen Feb 24 '21 at 09:02
  • Based on that file path, you're using Windows. `M_PI` isn't defined in the usual Windows C headers. – Shawn Feb 24 '21 at 09:04
  • You don't do that with CMake, fms.c is missing `#include `. m is specific to GCC, don't link it for MSVC. – Hans Passant Feb 24 '21 at 09:40

0 Answers0