McDonnas February 2016

CLion GNU STL Renderers

I am trying to debug a C++ program that uses std::map.
In this post http://blog.jetbrains.com/clion/2015/05/debug-clion/ it says that they support GNU STL Renderers if you include -stdlib=libstdc++ in the CMake file, however I get an error when building.

c++: error: unrecognized command line option '--stdlib=libstdc++'

Here is my CMake file

cmake_minimum_required(VERSION 3.3)

project(lint)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 --stdlib=libstdc++")

set(SOURCE_FILES main.cpp)
add_executable(lint ${SOURCE_FILES})

Here is my main.cpp

using namespace std;

int main() {
    list<map<string, int>*>* sint3 = new list<map<string,int>*>;
    sint3->push_front(new map<string,int>);
    return 0;
}

How do I get GNU STL Renderers to work like their announcement said?

Answers


iksemyonov February 2016

Remove this extra dash:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -stdlib=libstdc++")
//                                                  ^^^

One dash goes a long way in the command line!

Also, look closely at the linked article:

This feature works in GCC, and in the case of Clang it works for libstdc++ only.

From what I conclude that with g++, there is no need to append this option, the renderers should work out of the box.

Edit: the obligatory SO question link.

Post Status

Asked in February 2016
Viewed 3,247 times
Voted 4
Answered 1 times

Search




Leave an answer