私は、このように私のクラスの静的としての機能を定義している(関連するコードの抜粋)静的機能:ストレージ・クラスここ
として#ifndef connectivityClass_H
#define connectivityClass_H
class neighborAtt
{
public:
neighborAtt(); //default constructor
neighborAtt(int, int, int);
~neighborAtt(); //destructor
static std::string intToStr(int number);
private:
int neighborID;
int attribute1;
int attribute2;
#endif
と.cppファイルで指定することはできません
#include "stdafx.h"
#include "connectivityClass.h"
static std::string neighborAtt::intToStr(int number)
{
std::stringstream ss; //create a stringstream
ss << number; //add number to the stream
return ss.str(); //return a string with the contents of the stream
}
.cppファイルに「ストレージクラスがここで指定されていない可能性があります」というエラー(VS C++ 2010)が表示され、何が間違っているのかわかりません。
p.s.私は既に複写のように見えるthisを読んだことがありますが、彼がしているようにわかりません - 私は正しいとコンパイラは厄介です。どんな助けもありがとう、私はこれについての情報を見つけることができません! .cpp
ファイルの定義で
あなたは 'mutable'について確信していますか?これはBNFの* storage-class-specifier *として現れますが、それは1つとして動作しません。 'thread_local'はC++ 11の記憶域クラス指定子です。 –
@BenVoigt:はい、C++ 03§7.7.1は、これらの5つの指定子を明示的にリストしています。 –