0
C++ 클래스의 헤더 파일에서 extern "C"함수를 사용하려고합니다. 내가 오류C++에서 Extern "C"가 중복 된 심볼 오류를 일으킴 오류
duplicate symbol _currentInstance in:
main.o
GLHandler.o
가 계속 컴파일 할 때
은 내가 오른쪽 가드를했지만, 이런 일이 이유를 알아낼 수 없습니다 생각했다. 어떤 도움이라도 대단히 감사 할 것입니다.
다음은 헤더 파일입니다.
#ifndef GLHANDLER_H
#define GLHANDLER_H
#include "LoadedObject.h"
#ifdef __cplusplus
extern "C" {
void displayCallback();
}
#endif
class GLHandler {
private:
LoadedObject *object;
public:
GLHandler(LoadedObject *);
void initializeVBO(LoadedObject *);
void renderObject(struct model *);
void displayFunction(void);
model *createModel(void);
void setupDisplayCallback();
};
GLHandler *currentInstance;
#ifdef __cplusplus
}
#endif
#endif
EDIT : 신속하게 David에 의해 지적되었으므로 extern GLHandler * currentInstance가 오류를 수정했습니다.
아마도 'extern GLHandler * currentInstance;'가되어야할까요? –
main.c와 GLHandler.c에서이 함수를 확실히 구현하고 있습니다. 또는 헤더 파일에 삽입하고 인라인하지 않습니다. –