简体   繁体   English

OpenGL图像(GLI):找到一个或多个乘法定义的符号

[英]OpenGL Image (GLI) : one or more multiply defined symbols found

I'm trying to set up a class that uses GLI but I can't get the library to work even with simple code. 我正在尝试建立一个使用GLI的类,但是即使使用简单的代码,我也无法使该库正常工作。

-----------------------------------------------------------------------
                                 header.hpp
-----------------------------------------------------------------------
#pragma once

#include "gli\gli.hpp"

-----------------------------------------------------------------------
                                 source.cpp
-----------------------------------------------------------------------
#include "header.hpp"

-----------------------------------------------------------------------
                                 main.cpp
-----------------------------------------------------------------------
#include "header.hpp"

int main(int argc, char* argv[])
{
    return 0;
}

I never had a problem like this before but it seems like I can't include a header that includes the library itself in my main.cpp when it's already included in another .cpp file. 我以前从未遇到过这样的问题,但是似乎我无法在main.cpp中包含包含库本身的标头,而该标头已经包含在另一个.cpp文件中。 I can include the library directly in my source.cpp instead of my header.hpp but I don't think it would be a great solution. 我可以将库直接包含在我的source.cpp中,而不是header.hpp中,但是我认为这不是一个很好的解决方案。

The Visual-Studio build output says : Visual Studio构建输出显示:

fatal error lnk1169 one or more multiply defined symbols found 严重错误lnk1169找到一个或多个乘法定义的符号

See this bug https://github.com/g-truc/gli/issues/27 . 看到这个错误https://github.com/g-truc/gli/issues/27 Solution is to mark the view ctor and assignment operators as inline. 解决方案是将视图ctor和赋值运算符标记为内联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM