编译vim
插件color_coded
时会出现问题,可归纳如下:
g++ -std=c++14
,symlink
无法找到unistd.h
。clang++ -std=c++14
,cygwin不支持mutex
。那么,如何在cygwin上编译这段代码?
#include <unistd.h>
#include <mutex>
#include <thread>
#include <iostream>
std::mutex io_mutex;
auto foo(){
std::lock_guard<std::mutex> guard{io_mutex};
std::cout << &symlink << "\n";
}
int main(){
std::thread t1{foo}, t2{foo};
t1.join();
t2.join();
}
以下是错误。
gcc 5.4.0
和g++ -std=c++14
:
t.cpp: In function 'auto foo()':
t.cpp:9:18: error: 'symlink' was not declared in this scope
std::cout << &symlink << "\n";
使用clang 3.7.1
和clang++ -std=c++14
:
In file included from t.cpp:2:
/usr/lib/gcc/i686-pc-cygwin/5.4.0/include/c++/mutex:699:10: error: thread-local
storage is not supported for the current target
extern __thread void* __once_callable;
^
/usr/lib/gcc/i686-pc-cygwin/5.4.0/include/c++/mutex:700:10: error: thread-local
storage is not supported for the current target
extern __thread void (*__once_call)();
^
2 errors generated.