2012-11-24 4 views
0

내가 오일러 ​​각을 쿼터니온 변환기를 작성하고는,이 코드를 작성했습니다 :typedef가있는 동안 해결되지 않은 외부 기호 오류가 발생하는 이유는 무엇입니까?

//(...) 
/* 
* Converter Includes 
*/ 
#include "EulerAngles.h" 
//(...) 
static cell AMX_NATIVE_CALL n_QuatToEuler(AMX* amx, cell* params) 
{ 
    Quat q; 
    q.x = amx_ctof(params[1]); 
    q.y = amx_ctof(params[2]); 
    q.z = amx_ctof(params[3]); 
    q.w = amx_ctof(params[4]); 
    EulerAngles EU = Eul_FromQuat(q,params[5]); 
    //(...) 
    return 1; 
} 
//(...) 

나는, 내 프로젝트에 http://tog.acm.org/resources/GraphicsGems/gemsiv/euler_angle/에서 EulerAngles.c을 포함 나는 또한 내 프로젝트에 다른 모든 파일을 다운로드.

나는 비주얼 스튜디오 2012에서 이러한 오류 메시지 I 얻을 내 프로젝트를 컴파일 할 때 :

/**** QuatTypes.h - Basic type declarations ****/ 
#ifndef _H_QuatTypes 
#define _H_QuatTypes 
/*** Definitions ***/ 
typedef struct {float x, y, z, w;} Quat; /* Quaternion */ 
enum QuatPart {X, Y, Z, W}; 
typedef float HMatrix[4][4]; /* Right-handed, for column vectors */ 
typedef Quat EulerAngles; /* (x,y,z)=ang 1,2,3, w=order code */ 
#endif 

: EulerAngles.h에 포함되어

Error 1 error LNK2001: unresolved external symbol "struct Quat __cdecl Eul_FromQuat(struct Quat,int)" ([email protected]@[email protected]@[email protected]@Z) .\calculatorSAMP\calculatorSAMP.obj calculatorSAMP 
Error 2 error LNK1120: 1 unresolved externals .\calculatorSAMP\Release\calculatorSAMP.dll calculatorSAMP 

QuadTypes.h이 코드가를 내가 여기서 무엇을 놓치고 있니?

나는 그것을 수정하려고 :

/**** QuatTypes.h - Basic type declarations ****/ 
#ifndef _H_QuatTypes 
#define _H_QuatTypes 
/*** Definitions ***/ 
struct Quat {float x, y, z, w;}; /* Quaternion */ 
enum QuatPart {X, Y, Z, W}; 
typedef float HMatrix[4][4]; /* Right-handed, for column vectors */ 
#define EulerAngles Quat ; /* (x,y,z)=ang 1,2,3, w=order code */ 
#endif 

그러나 이상의 오류가 발생했습니다.

+0

'EulerAngles.c'에는 링크가없는 것 같습니다. 너는 어떻게 꾸미고 있니? – Xymostech

+0

VS2012의 BUILD 메뉴에서 "Build Project"를 선택하면 프로젝트의 파일에 EurlerAngles.c가 qadded되었습니다. –

+0

EulerAngles.c의 소스 코드를 제 주 .cpp 파일에 포함 시켰습니다. 컴파일이되었는데, 왜 내 파일이 링크되어 있지 않습니까? –

답변

0

.c 파일 인 경우 기본적으로 C로 컴파일됩니다.

해당 파일의 "다른 이름으로 컴파일"옵션을 변경하거나 .h 파일의 선언에 extern "C"을 추가해야합니다.

1

오류는 기능을 누락 말한다 :

Eul_FromQuat(struct Quat,int); 

내가 제공 한 코드에서 해당 기능을 볼 수 없습니다.

그래서 컴파일러와 필자는 모두 누락 된 것으로 결론을 내리고 해결되지 않은 기호입니다.

+0

http://tog.acm.org/resources/GraphicsGems/gemsiv/euler_angle/EulerAngles.c에 추가되었습니다. – Xymostech

관련 문제