C++ 코딩 방법을 거의 잊어 버렸습니다. 어쨌든, 여기에 문제가 있습니다.C++ 컴파일 문제
내가 작성한 .cpp 파일에 정의 된 클래스를로드하려고합니다. 메인 함수에서
:... ...
#include "loader.h"
... ...
model load_model("TechnologyEnterpriseFacility_Day_Gregor/
TechnologyEnterpriseFacility_Gregor.model");
헤더 파일은 다음과 같습니다
#ifndef LOADER_H_
#define LOADER_H_
class model
{
public:
int textures [];
float vertices[][3];
float triangles[][13];
model(const char*); // constructor
};
#endif /* LOADER_H_ */
을 여기 .cpp 파일입니다 : 내가 메인 컴파일 할 때
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <typeinfo>
#include "loader.h"
using namespace std;
model::model(const char* filename)
{
... ...
함수에 오류 메시지가 표시됩니다.
gcc -o glrender glrender.cpp -lglut
/tmp/cc3sWIgb.o: In function `__static_initialization_and_destruction_0(int, int)':
glrender.cpp:(.text+0x11b): undefined reference to `model::model(char const*)'
collect2: ld returned 1 exit status
의견과 아이디어를 환영합니다. 감사합니다.
주요 기능은 클래스를 구현하는 cpp 파일과 같은 파일에 있습니까? – Javier