You are not logged in.
Trying to compile the following code with clang.
clang -std=c++17 -stdlib=libc++ -lc++abi -Wall -Wextra -pedantic test.cpp
gcc-7 is perfectly fine with it.
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
The full error is here: https://paste.ubuntu.com/p/kWFQwNTNS6/. (Ubuntu paste is awesome with no ads)
I tried it on compiler explorer. It's working fine(Clang version is 5.0.0 however). See https://godbolt.org/g/Sa1EN2
#include <iostream>
#include <regex>
#include <string>
int main()
{
std::string pattern("[^c]ei");
pattern = "[[:alpha:]]*" + pattern + "[[:alpha:]]*";
std::regex r(pattern);
std::smatch results;
std::string test_string = "receipt friend theif receive";
if (std::regex_search(test_string, results, r)) {
std::cout << results.str() << std::endl;
}
return 0;
}
Last edited by johannkokos (2018-02-28 14:37:03)
Offline
Using ArchLinux.
When I use option
-stdlib=libc++
, I get error:
x3.cc:1:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
When I use option
-lc++abi
, I get error:
/usr/bin/ld: cannot find -lc++abi
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
Offline
Offline
Thanks.
Just found I am using a older version of libc++. Updating to 5.0.1 solves the problem.
Last edited by johannkokos (2018-02-28 14:37:36)
Offline