Question

Error

error C2668: 'sqrt' : ambiguous call to overloaded function c:\program files\assimp\include\assimp\vector3.inl

occures when I include 'scene.h' in main cpp file:

#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"

I can't get what does it conflict with?

Was it helpful?

Solution

You have a namespace using-directive in your .cpp file:

using namespace glm;

This means that everything that is in the glm namespace becomes part of the "global" namespace; so you are polluting the global namespace.

So, there might be some form of conflict between the standard C sqrt() function (which lives in the global namespace) and your glm::sqrt(), which is "promoted" to a global sqrt.

You may want to remove the aforementioned namespace using-directive (and just add the glm:: namespace prefix when you want to reference classes and functions in that namespace).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top