Binary '=': no operator found which takes a right-hand operand of type 'glm::tvec4<float,0>' (Fix new GLM into old GLM for learning purpose)

VulkanSDK 1.2.182.0
Visual Studio 2015
GLM: 0.9.6.3 (note that glm is missing from the example, I have to extract the glm zip file and put the glm folder to the folder named “external” in the example)

Vulkan C++ examples and demos
GitHub - SaschaWillems/Vulkan: Examples and demos for the new Vulkan API
That Vulkan example above is extremely rich for learning purpose but I cannot compile it. The errors are indicated in the code very below.

If anyone can help me, thanks. It’s a very rich Vulkan example.

---------- File: gltfloading.cpp in GLM project ----------

	// Append data to model's vertex buffer
	for (size_t v = 0; v < vertexCount; v++) {
		Vertex vert{};

		vert.pos = glm::vec4(glm::make_vec3(&positionBuffer[v * 3]), 1.0f);
Error C2679 binary '=': no operator found which takes a right-hand operand of type 'glm::tvec4<float,0>' (or there is no acceptable conversion)

		vert.normal = glm::normalize(glm::vec3(normalsBuffer ? glm::make_vec3(&normalsBuffer[v * 3]) : glm::vec3(0.0f)));

		vert.uv = texCoordsBuffer ? glm::make_vec2(&texCoordsBuffer[v * 2]) : glm::vec3(0.0f);
Error C2446 ':': no conversion from 'glm::tvec3<float,0>' to 'glm::tvec2<float,0>'

		vert.color = glm::vec3(1.0f);
		vertexBuffer.push_back(vert);
	}

---------- File: type_vec3.hpp in GLM project ----------
namespace glm
{
    template <typename T, precision P = defaultp>
    struct tvec3
    {
        ...
        GLM_FUNC_DECL tvec3();
        GLM_FUNC_DECL tvec3(tvec3<T, P> const & v);
        ...
       
        //**** EDIT by me: Example of how I'm trying to fix the problem, not a permanent fix ****
        GLM_FUNC_DECL tvec3(tvec3<T, P> const & v, T const & c)
        {
             this->x = v.x;
             this->y = v.y;
             this->z = v.z;
        }
        // But it doen't work.
        ...
    }
}

Solved, according to my experience about Forums, the solution can be something very different that has nothing to do with my question, and here is the solution:

The original error I didn’t mention is “glm/glm.hpp” cannot be found, so I include glm in the project by modifying the CMakeLists.txt as follows:

# It's you to set the variable VULKAN_PATH, but I cannot show it because it's too big, it's like a mistake to show it.

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
	# Include Vulkan header files from Vulkan SDK
	include_directories(AFTER ${VULKAN_PATH}/Include)
	include_directories(AFTER ${VULKAN_PATH}/Third-Party/Include)

	# Link directory for vulkan-1
	link_directories(${VULKAN_PATH}/Bin;${VULKAN_PATH}/Lib;${VULKAN_PATH}/Third-Party/Bin;)
endif()

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.