私はこのコードに何かがひどく間違っていると思います。それはコンパイルされますが、リンクされません。C++タプルリンクの問題:未定義の参照
#include <iostream>
#include <tuple>
class Table_class
{
public:
constexpr static std::tuple<int, unsigned int, unsigned short> table[3]
= {std::make_tuple(1, 2, 3),
std::make_tuple(4, 5, 6),
std::make_tuple(7, 8, 9)};
};
int main()
{
std::cout << std::get<0>(Table_class::table[0]);
return 0;
}
現れるエラーがこれです:
[31m/tmp/ccDiIuPv.o: In function `main':
file.cpp:(.text+0x5): undefined reference to `Table_class::table'
collect2: error: ld returned 1 exit status
Compilation Failed
どのようにこれを修正することができますか?
の可能な重複(http://stackoverflow.com/questions/5019856/c-initialize-static-variables-in-class) – Ari0nhh