【发布时间】:2014-05-09 15:15:17
【问题描述】:
错误
错误 C2668: 'sqrt' : 对重载函数 c:\program files\assimp\include\assimp\vector3.inl 的模糊调用
当我在主 cpp 文件中包含“scene.h”时发生:
#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"
我不明白它与什么冲突?
【问题讨论】:
-
glm命名空间是否包含 sqrt 函数? -
@ratchetfreak 我认为是的,因为它是数学库,但为什么它们会发生冲突?
-
因为
sqrt(var)可以指标准 sqrt 或 glm one -
@RevanReborn:如果
glm确实包含sqrt,那么将命名空间内容转储到具有using namespace glm;的全局命名空间将导致与C 库中的冲突。像这样污染全局命名空间绝不是一个好主意。 -
如何结束这个问题?
标签: c++ opengl ambiguous assimp