SimpleAudioDenoise icon indicating copy to clipboard operation
SimpleAudioDenoise copied to clipboard

CMake Error& Compile Error in Centos 7

Open ChrisZhangJin opened this issue 5 years ago • 1 comments

the CMakeList.txt will raise error in Centos 7

project(SimpleDenoise LANGUAGES C) # change to project(SimpleDenoise)

After that, cmake runs OK. but compilation failed. the C-compilation must comply with C99 stadand, so I added this

set(CMAKE_C_FLAGS "-std=c99")

the C-style compilation errors have gone, however, there is still issue in main.c. the author uses some object that comes from c++11, so I need to add the c++11 support in the CMakeList.txt too

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

Anyway, it's working now.

ChrisZhangJin avatar Jan 20 '20 07:01 ChrisZhangJin

In Debian Wheezy, the original CMakeList.txt does not work. Only works:

cmake_minimum_required(VERSION 2.8)
project(SimpleDenoise LANGUAGES C)

add_definitions(-std=c99 -D_POSIX_C_SOURCE=199309L)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(CMAKE_BUILD_TYPE "Release")

include_directories(include)
add_executable(${PROJECT_NAME} main.c)

target_link_libraries(${PROJECT_NAME} -lm -lrt)

zvezdochiot avatar Apr 29 '20 12:04 zvezdochiot