Giter Club home page Giter Club logo

Comments (7)

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


You must link against OpenGL ( in mingw should be "opengl32" lib ).

from soil2.

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Vadim Melnicuk (Bitbucket: vadimmelnicuk, GitHub: vadimmelnicuk).


I have linked opengl32 using find_package(OpenGL REQUIRED) and target_link_libraries(${OPENGL_gl_LIBRARY}) later. I am also including <GL/glew.h> before <SOIL2.h>. Neither glfw nor glew complain about opengl references.

from soil2.

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


I don't use CMake, but i did a quick test and builded without problems.

I'm pretty sure that your mistake is here:

target_link_libraries(${OPENGL_gl_LIBRARY})

it should be:

target_link_libraries(binaryname ${OPENGL_LIBRARIES})

You can see the CMakeLists file that i created, here: http://pastebin.com/aVvrt6Nx ( if you wan't to use it you'll need to get the FindSDL2.cmake file from here: https://github.com/tcbrindle/sdl2-cmake-scripts ( and place it in the subfolder cmake ). And used mingw to build it ( cmake -G "MinGW Makefiles" CMakeLists.txt ).

from soil2.

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Vadim Melnicuk (Bitbucket: vadimmelnicuk, GitHub: vadimmelnicuk).


I am trying to link against SOIL2 static library, that is libsoil2.a
I have also changed OPENGL_gl_LIBRARY to OPENGL_LIBRARIES, but soil still fails to find a reference to opengl functions.

from soil2.

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


If you want to, you can show me the CMakeList.txt that you are using. But since i don't even know more than the basics of CMake and i don't provide support for CMake with the library, i think that it would be more appropriate to ask how to solve your issue in a CMake forum, since it's not a problem with SOIL but with your Makefile generation. Anyways, show me your CMake file at least to see if i can help.

from soil2.

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Vadim Melnicuk (Bitbucket: vadimmelnicuk, GitHub: vadimmelnicuk).


Hello, Martin. Sorry for the late response. I have included my CMakeLists.txt below:
Also, this links well on linux and osx, windows complains about gl references though.

#!c
cmake_minimum_required(VERSION 3.6)
project(Neoconomy)

if (WIN32)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
else ()
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif (WIN32)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")

set(SOURCE_FILES main.cpp HUGE_LIST_OF_FILES)
add_executable (${PROJECT_NAME} ${SOURCE_FILES})

find_package(OpenGL REQUIRED)
find_package(glew REQUIRED)
find_package(glfw3 3.2 REQUIRED)
find_package(soil2 REQUIRED)

if (WIN32)
    target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} ${GLEW_LIBRARIES} ${SOIL2_LIBRARIES})
else ()
    if (APPLE)
        target_link_libraries(${PROJECT_NAME} "-framework CoreFoundation" ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} ${GLEW_LIBRARIES} ${SOIL2_LIBRARIES})
    else ()
        target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} ${GLEW_LIBRARIES} ${SOIL2_LIBRARIES})
    endif (APPLE)
endif (WIN32)

include_directories(${CMAKE_SOURCE_DIR}/include) # Header only libraries are found here
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${GLEW_INCLUDE_DIR}) # GLEW INCLUDE DIR DOI!
include_directories(${GLFW_INCLUDE_DIR}) # GLFW INCLUDE DIR DOI!
include_directories(${SOIL2_INCLUDE_DIR})

from soil2.

SpartanJ avatar SpartanJ commented on June 22, 2024

Original comment by Rubick (Bitbucket: CuriousRubick, GitHub: CuriousRubick).


I fixed this problem by simply linking SOIL2 before opengl32.lib . If using Codeblocks, go to build options -> linker settings, and move SOIL2 above opengl.

Wasn't an issue in Visual Studio.

from soil2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.