2014-05-09 9 views
0

오류'SQRT': 'SQRT': 오버로드 된 함수 C에 모호한 전화 : assimp 포함 프로그램 파일 과부하 기능 t .. assimp vector3.inl

오류 C2668에 모호한 전화

vector3.inl assimp \ 내가 주 CPP 파일에 'scene.h'를 포함 할 때 occures :

#include "stdafx.h" 
#include <stdio.h> 
#include <stdlib.h> 
#include <GL/glew.h> 
#include <GLFW/glfw3.h> 
GLFWwindow* window; 
#include <glm/glm.hpp> 
#include <glm/gtx/transform.hpp> 
#include <glm/gtc/matrix_transform.hpp> 
#include <assimp/Importer.hpp> 
#include <assimp/scene.h> 
#include <assimp/postprocess.h> 
#define MESH_FILE "cube.obj" 
using namespace glm; 
#include "common/shader.hpp" 
#include "common/controls.hpp" 

나는 그것이 충돌 무엇을 얻을 수 있습니까?

+1

'glm' 네임 스페이스에 sqrt 함수가 있습니까? –

+0

@ratchetfreak 나는 그것이 수학 라이브러리이기 때문에 그렇다고 생각하지만 왜 충돌 하는가? – RevanReborn

+0

왜냐하면'sqrt (var)'는 표준 sqrt 또는 glm one을 참조 할 수 있기 때문이다. –

답변

1

당신은 사용-지시 당신의 .cpp 파일에 네임 스페이스 이 :이 glm 네임 스페이스에 모든 것이 "글로벌"네임 스페이스의 일부가 있음을 의미

using namespace glm; 

; 그래서 은 글로벌 네임 스페이스 인을 오염시킵니다.

표준 C sqrt() 함수 (전역 네임 스페이스에 있음)와 glm::sqrt() 사이에 충돌이있을 수 있습니다. 이는 sqrt으로 "승격"됩니다.

-directive를 사용하여 위에서 언급 한 네임 스페이스를 제거하고 해당 네임 스페이스에서 클래스와 함수를 참조 할 때 glm:: 네임 스페이스 접두사를 추가 할 수 있습니다.