私はLinuxマシン(ubuntu)上で本当に簡単なスレッドプログラムをコンパイルしようとしていますが、libC++を指定してもclangが私にエラーを投げかけているようです。私のプログラムは次のとおりです。式はintergral定数ではありません。clang libC++ thread
#include <iostream>
#include <thread>
void call_from_thread() {
std::cout << "Hello, World!" << std::endl;
}
int main()
{
std::thread t1(call_from_thread);
t1.join();
return 0;
}
メイク:
CC=clang++
CFLAGS=-std=c++11 -stdlib=libc++ -pthread -c -Wall
#proper declaration of libc++, but still an error...
LDFALGS=
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=bimap
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o [email protected]
.cpp.o:
$(CC) $(CFLAGS) $< -o [email protected]
特定のエラー:
In file included from main.cpp:2:
In file included from /usr/include/c++/4.6/thread:37:
/usr/include/c++/4.6/chrono:666:7: error: static_assert expression is not an
integral constant expression
static_assert(system_clock::duration::min()
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [main.o] Error 1
打ち鳴らすがあるため、libcの++を使用していない理由を私はよく分かりませんもし私が間違っていないなら、clangはこのライブラリを使ってスレッドをコンパイルします。どんな助けもありがとう!
おそらく、私たちにclangが提供するエラーを表示します。 – hetepeperfan
あなたは間違って 'LDFLAGS'を綴りました。 – kennytm
これは既知の問題であることに注意してください。 [LLVM report](http://llvm.org/bugs/show_bug.cgi?id=12893)、[Ubuntu report](https://bugs.launchpad.net/ubuntu/+source/clang/+bug/1081905) )、[Debian report](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666539)、[Clangメーリングリスト](http://lists.cs.uiuc.edu/pipermail/cfe -dev/2011-June/015641.html) – Albert