compiling c++17 based project under centOS
I've got project that should be compiled with c++17 under clean minimal centOS 7.6
For a start I updated the gnu compiler package from the default 4.8.5 to 7.4.0
and my cmake package to 3.12.2
which should have support for c++17
standard.
now I've got the following configuration :
[root@localhost Client]# gcc --version
gcc (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# g++ --version
g++ (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# cmake3 --version
cmake3 version 3.12.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
However, when I try to run cmake3 .
on my project home dir, I get
Target "myproj" requires the language dialect "CXX17" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
Here's the CMakeLists.txt
:
cmake_minimum_required(VERSION 3.0.0)
project(myproj VERSION 0.1.0)
set(PROJ_BASE ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB SOURCES "*.cpp")
add_library(myproj STATIC ${SOURCES})
set_target_properties(myproj PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
Anything that I'm missing here ?
c++ gcc centos c++17
|
show 5 more comments
I've got project that should be compiled with c++17 under clean minimal centOS 7.6
For a start I updated the gnu compiler package from the default 4.8.5 to 7.4.0
and my cmake package to 3.12.2
which should have support for c++17
standard.
now I've got the following configuration :
[root@localhost Client]# gcc --version
gcc (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# g++ --version
g++ (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# cmake3 --version
cmake3 version 3.12.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
However, when I try to run cmake3 .
on my project home dir, I get
Target "myproj" requires the language dialect "CXX17" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
Here's the CMakeLists.txt
:
cmake_minimum_required(VERSION 3.0.0)
project(myproj VERSION 0.1.0)
set(PROJ_BASE ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB SOURCES "*.cpp")
add_library(myproj STATIC ${SOURCES})
set_target_properties(myproj PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
Anything that I'm missing here ?
c++ gcc centos c++17
1
Are you running cmake on clean project? Maybe you have some stuff cached by cmake from before you've installed new gcc?
– VTT
Jan 3 at 8:05
Did you try to set the compiler withCXX=g++ CC=gcc cmake .
?
– Thomas Sablik
Jan 3 at 8:05
CMake will create a couple of log-files containing information about what it tried and possible errors. You might want to look into those files to help you understand the problem.
– Some programmer dude
Jan 3 at 8:07
Did you update cmake-modules, too? If you forgot to update cmake-modules, cmake uses older compiler detection
– Thomas Sablik
Jan 3 at 8:08
1
Also please attempt to create a Minimal, Complete, and Verifiable example of yourCMakeLists.txt
file that you can show us. Especially tell us how you're setting the standard version.
– Some programmer dude
Jan 3 at 8:08
|
show 5 more comments
I've got project that should be compiled with c++17 under clean minimal centOS 7.6
For a start I updated the gnu compiler package from the default 4.8.5 to 7.4.0
and my cmake package to 3.12.2
which should have support for c++17
standard.
now I've got the following configuration :
[root@localhost Client]# gcc --version
gcc (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# g++ --version
g++ (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# cmake3 --version
cmake3 version 3.12.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
However, when I try to run cmake3 .
on my project home dir, I get
Target "myproj" requires the language dialect "CXX17" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
Here's the CMakeLists.txt
:
cmake_minimum_required(VERSION 3.0.0)
project(myproj VERSION 0.1.0)
set(PROJ_BASE ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB SOURCES "*.cpp")
add_library(myproj STATIC ${SOURCES})
set_target_properties(myproj PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
Anything that I'm missing here ?
c++ gcc centos c++17
I've got project that should be compiled with c++17 under clean minimal centOS 7.6
For a start I updated the gnu compiler package from the default 4.8.5 to 7.4.0
and my cmake package to 3.12.2
which should have support for c++17
standard.
now I've got the following configuration :
[root@localhost Client]# gcc --version
gcc (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# g++ --version
g++ (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost Client]# cmake3 --version
cmake3 version 3.12.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
However, when I try to run cmake3 .
on my project home dir, I get
Target "myproj" requires the language dialect "CXX17" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
Here's the CMakeLists.txt
:
cmake_minimum_required(VERSION 3.0.0)
project(myproj VERSION 0.1.0)
set(PROJ_BASE ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB SOURCES "*.cpp")
add_library(myproj STATIC ${SOURCES})
set_target_properties(myproj PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
Anything that I'm missing here ?
c++ gcc centos c++17
c++ gcc centos c++17
edited Jan 3 at 8:10
Zohar81
asked Jan 3 at 7:57
Zohar81Zohar81
2,2142833
2,2142833
1
Are you running cmake on clean project? Maybe you have some stuff cached by cmake from before you've installed new gcc?
– VTT
Jan 3 at 8:05
Did you try to set the compiler withCXX=g++ CC=gcc cmake .
?
– Thomas Sablik
Jan 3 at 8:05
CMake will create a couple of log-files containing information about what it tried and possible errors. You might want to look into those files to help you understand the problem.
– Some programmer dude
Jan 3 at 8:07
Did you update cmake-modules, too? If you forgot to update cmake-modules, cmake uses older compiler detection
– Thomas Sablik
Jan 3 at 8:08
1
Also please attempt to create a Minimal, Complete, and Verifiable example of yourCMakeLists.txt
file that you can show us. Especially tell us how you're setting the standard version.
– Some programmer dude
Jan 3 at 8:08
|
show 5 more comments
1
Are you running cmake on clean project? Maybe you have some stuff cached by cmake from before you've installed new gcc?
– VTT
Jan 3 at 8:05
Did you try to set the compiler withCXX=g++ CC=gcc cmake .
?
– Thomas Sablik
Jan 3 at 8:05
CMake will create a couple of log-files containing information about what it tried and possible errors. You might want to look into those files to help you understand the problem.
– Some programmer dude
Jan 3 at 8:07
Did you update cmake-modules, too? If you forgot to update cmake-modules, cmake uses older compiler detection
– Thomas Sablik
Jan 3 at 8:08
1
Also please attempt to create a Minimal, Complete, and Verifiable example of yourCMakeLists.txt
file that you can show us. Especially tell us how you're setting the standard version.
– Some programmer dude
Jan 3 at 8:08
1
1
Are you running cmake on clean project? Maybe you have some stuff cached by cmake from before you've installed new gcc?
– VTT
Jan 3 at 8:05
Are you running cmake on clean project? Maybe you have some stuff cached by cmake from before you've installed new gcc?
– VTT
Jan 3 at 8:05
Did you try to set the compiler with
CXX=g++ CC=gcc cmake .
?– Thomas Sablik
Jan 3 at 8:05
Did you try to set the compiler with
CXX=g++ CC=gcc cmake .
?– Thomas Sablik
Jan 3 at 8:05
CMake will create a couple of log-files containing information about what it tried and possible errors. You might want to look into those files to help you understand the problem.
– Some programmer dude
Jan 3 at 8:07
CMake will create a couple of log-files containing information about what it tried and possible errors. You might want to look into those files to help you understand the problem.
– Some programmer dude
Jan 3 at 8:07
Did you update cmake-modules, too? If you forgot to update cmake-modules, cmake uses older compiler detection
– Thomas Sablik
Jan 3 at 8:08
Did you update cmake-modules, too? If you forgot to update cmake-modules, cmake uses older compiler detection
– Thomas Sablik
Jan 3 at 8:08
1
1
Also please attempt to create a Minimal, Complete, and Verifiable example of your
CMakeLists.txt
file that you can show us. Especially tell us how you're setting the standard version.– Some programmer dude
Jan 3 at 8:08
Also please attempt to create a Minimal, Complete, and Verifiable example of your
CMakeLists.txt
file that you can show us. Especially tell us how you're setting the standard version.– Some programmer dude
Jan 3 at 8:08
|
show 5 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018372%2fcompiling-c17-based-project-under-centos%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018372%2fcompiling-c17-based-project-under-centos%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Are you running cmake on clean project? Maybe you have some stuff cached by cmake from before you've installed new gcc?
– VTT
Jan 3 at 8:05
Did you try to set the compiler with
CXX=g++ CC=gcc cmake .
?– Thomas Sablik
Jan 3 at 8:05
CMake will create a couple of log-files containing information about what it tried and possible errors. You might want to look into those files to help you understand the problem.
– Some programmer dude
Jan 3 at 8:07
Did you update cmake-modules, too? If you forgot to update cmake-modules, cmake uses older compiler detection
– Thomas Sablik
Jan 3 at 8:08
1
Also please attempt to create a Minimal, Complete, and Verifiable example of your
CMakeLists.txt
file that you can show us. Especially tell us how you're setting the standard version.– Some programmer dude
Jan 3 at 8:08