I tried the advice in this answer, but it's for GCC and didn't help anyways.
I want to #include <thread>
in a file, so I have a make file as the following:
OBJS = clitest.o Sources/NClient.o
CC = g++
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
clitest: $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o clitest
Where should I include -std=c++11
and -lpthread
in this?
I've tried just about every combination I can, but I continue to get this error when I run make
:
/usr/include/c++/4.8.3/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
I believe this is the command it's running?
[jaska@localhost NClient]make
g++ -c -o clitest.o clitest.cpp
Here's the source code file, too:
#include <thread>
#include <string>
void task(std::string msg){
std::cout << msg << '\n';
}
...
...
std::thread t1(task, "message");
client->create();
t1.join();