c++ - Undefined reference linking static libSOIL.a on g++ linux -


i'm trying build opengl project, worked until tried use soil library (http://www.lonesock.net/soil.html) loading textures images. library comes soil.h , libsoil.a files.

that's when doing make:

g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/main.o src/main.cpp g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/file_ply_stl.o src/file_ply_stl.cpp g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/proyecto.o src/proyecto.cpp g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/clock.o src/clock.cpp g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/utils.o src/utils.cpp  ...  g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/primitives/cilindro.o src/primitives/cilindro.cpp g++ -i./src -wl,-rpath,./lib -o3 -g   -c -o src/primitives/cono.o src/primitives/cono.cpp g++ -i./src -wl,-rpath,./lib -o3 -g -o app -l./lib src/main.o src/file_ply_stl.o src/proyecto.o src/clock.o src/utils.o src/window.o src/light.o src/material.o src/plymodel.o src/placeable.o src/moveable.o src/model.o src/texture.o src/geometry.o src/trigeometry.o src/triindgeometry.o src/entity.o src/camera.o src/bounded.o src/animatable.o src/scene.o src/graphics.o src/vert.o src/path.o src/ant.o src/tank.o src/chess.o src/primitives/tetra.o src/primitives/cubo.o src/primitives/cilindro.o src/primitives/cono.o -lsfml-window -lsfml-system -lx11 -lxext -lxmu -lxi -lxt -lsm -lice -lglu -lgl -lglut -lsoil src/texture.o: in function `texture::ini(char const*)': /home/roger/t/ig/prac/proyecto/src/texture.cpp:9: undefined reference `soil_load_ogl_texture' collect2: ld devolvió el estado de salida 1 make: *** [app] error 1 

and that's makefile:

target = app  modules = src/main.o src/file_ply_stl.o src/proyecto.o src/clock.o src/utils.o engine = src/window.o src/light.o src/material.o src/plymodel.o src/placeable.o src/moveable.o src/model.o src/texture.o src/geometry.o src/trigeometry.o src/triindgeometry.o src/entity.o src/camera.o src/bounded.o src/animatable.o src/scene.o src/graphics.o src/vert.o game = src/path.o src/ant.o src/tank.o primitives = src/chess.o src/primitives/tetra.o src/primitives/cubo.o src/primitives/cilindro.o src/primitives/cono.o  cxx = g++ libdir = ./lib incdir = ./src  libs = -lsfml-window -lsfml-system -lx11 -lxext -lxmu -lxi -lxt -lsm -lice -lglu -lgl -lglut -lsoil  ldflags = -l$(libdir) cxxflags = -i$(incdir) -wl,-rpath,$(libdir) -o3 -g  $(target): $(modules) $(engine) $(game) $(primitives)     $(cxx) $(cxxflags) -o $(target) $(ldflags) $(modules) $(engine) $(game) $(primitives) $(libs)  clean:     rm -f $(modules) $(engine) $(game) $(primitives) $(target) 

and that's file hierachy:

.: lib makefile src  ./lib: libsfml-audio.so       libsfml-graphics.so.2.0  libsfml-system.so.2    libsoil.a libsfml-audio.so.2     libsfml-network.so       libsfml-system.so.2.0  libsoil.a.1 libsfml-audio.so.2.0   libsfml-network.so.2     libsfml-window.so      libsoil.a.1.0 libsfml-graphics.so    libsfml-network.so.2.0   libsfml-window.so.2 libsfml-graphics.so.2  libsfml-system.so        libsfml-window.so.2.0  ./src: animatable.cpp  clock.cpp         light.cpp     moveable.h     random.h         trigeometry.h animatable.h    clock.h           light.h       path.cpp       scene.cpp        triindgeometry.cpp ant.cpp         entity.cpp        main.cpp      path.h         scene.h          triindgeometry.h ant.h           entity.h          main.h        placeable.cpp  sfml             utils.cpp bounded.cpp     file_ply_stl.cpp  material.cpp  placeable.h    soil             utils.h bounded.h       file_ply_stl.h    material.h    plymodel.cpp   tank.cpp         vert.cpp camera.cpp      geometry.cpp      matrix.h      plymodel.h     tank.h           vertex.h camera.h        geometry.h        model.cpp     primitives     texture.cpp      vert.h chess.cpp       graphics.cpp      model.h       proyecto.cpp   texture.h        window.cpp chess.h         graphics.h        moveable.cpp  proyecto.h     trigeometry.cpp  window.h  ./src/primitives: ...  ./src/sfml: ...  ./src/sfml/audio: ...  ./src/sfml/graphics: ...  ./src/sfml/network: ...  ./src/sfml/system: ...  ./src/sfml/window: ...  ./src/soil: soil.h 

i don't know what's going on, , why compiler doesn't find library file. i've got #include "soil/soil.h" in texture.h , call soil_load_ogl_texture in texture.cpp:9, that's name on function defined in soil.h. ¿what doing bad?

edit

i using library provided, compiled myself , worked.

i must write down answer when compile soil library question asked 4 year ago, because hard write cmakelists.txt myself before find cmakelists.txt.

the cmakelists.txt

cmake_minimum_required (version 2.6) project (soil)  set (soil_build_tests false cache bool "build tests")  if(android)    # android requires gl es 2.0 package automatically   set(libraries glesv2) else()   find_package (opengl required)   include_directories (${opengl_include_dir})   set(libraries ${opengl_libraries}) endif()  file (glob soil_sources src/*.c) file (glob soil_headers src/*.h)  add_library (soil ${soil_sources} ${soil_headers}) target_link_libraries (soil ${libraries})  install (targets soil library destination lib archive destination lib) install (files ${soil_headers} destination include/soil)  if (soil_build_tests)     add_executable (test_soil src/test_soil.cpp)     target_link_libraries (test_soil soil)     install (targets soil test_soil runtime destination bin) endif () 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -