简体   繁体   中英

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.

-----------------------------------------------------------------------
                                 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. 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.

The Visual-Studio build output says :

fatal error lnk1169 one or more multiply defined symbols found

See this bug https://github.com/g-truc/gli/issues/27 . Solution is to mark the view ctor and assignment operators as inline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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