Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I normally use the G++ compiler, but I don't have anything against using clang++. Reading about this, I get the idea that G++'s implementation of C++11's regex might not compile, and if it does, it might crash at runtime. So I was going to try clang++.

I had the following test file:

#include <regex>

int main()
{
        return 0;
}

When I try to compile with clang++ -std=c++11 -stdlib=libc++ test.cpp -o test.cpp, I get the error:

#include <regex>
         ^
1 error generated.

What am I missing? Do I need to install a specific package? Am I trying to do it the hard way with clang++, and I should just use g++?

share|improve this question
    
Much of regex seems to be implemented as per this, although compiling with libc++ should work. Can you try it with g++? –  saiarcot895 May 25 at 0:54
    
@saiarcot895 I can compile the short program with g++. But my concern with that is I don't know what will or will not trigger runtime bugs -- the page that you referenced says This page describes the C++ support in mainline GCC SVN, not in any particular release. I have g++ 4.8.2. –  Azendale May 25 at 1:01
    
Ah, you're right, and this bug says that full implementation is in GCC 4.9, and there may be partial implementation with runtime bugs in earlier versions. –  saiarcot895 May 25 at 1:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.