0
此模板定义使用MSVC可以,但无法在GNU上编译。问题是什么? 编辑:我已用C++ 11选项(使用的mingw32)编译它常量全局变量的模板
#include <iostream>
using namespace std;
template <typename T>
const static size_t ALIGN_MASK = 64/sizeof(T) - 1;
int main() {
// your code goes here
cout << ALIGN_MASK<double>;
return 0;
}
你用'-std = C++ 14'编译了吗? –
[Works for me](http://coliru.stacked-crooked.com/a/3277f41804038b50)。 –
我已经使用的mingw32和-std = C++ 11(在没有mingw的C++ 14) – Laci