0
구조체 형식이있는 벡터의 크기를 가져 오는 데 문제가 있습니다. apples.h :C++ 구조체 형식의 벡터 크기를 얻는 방법
#ifndef APPLES_H
#define APPLES_H
#include <vector>
#include <iostream>
struct a{
int b;
bool c;
};
class apples
{
public:
apples();
~apples();
protected:
private:
static std::vector<a> d;
};
#endif // APPLES_H
apples.cpp : MAIN.CPP 나던 심지어 사과 클래스를 이렇게 부릅니다 :
#include "apples.h"
std::vector<a> d;
apples::apples()
{
std::cout<<d.size()<<std::endl;
}
apples::~apples()
{
//dtor
}
이 코드는 나에게 " 'D 사과'정의되지 않은 참조를"제공 나는 게시 지점을 보지 못합니다
추가 설명 : http://stackoverflow.com/questions/7531981/how-to-instantiate-a-static-vector-of-object – TriHard8