Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Starting SFML - Problem with Code::Blocks and libGlew  (Read 1910 times)

0 Members and 1 Guest are viewing this topic.

Kashlavor

  • Newbie
  • *
  • Posts: 4
    • View Profile
Starting SFML - Problem with Code::Blocks and libGlew
« on: September 01, 2013, 12:35:42 am »
I'm having some difficulty getting SFML 2.1 to work.  I had already used 2.0 before and decided to upgrade.

I downloaded and installed the newest version of Code::Blocks (12.11), and then downloaded the SFML source and compiled using CMake and makefiles (asking for static libraries).

The example programs run, and I can compile them using make, the problem comes when I try to make a new project in Code::Blocks. 

Following the tutorial I started a blank project, copy/pasted in the tutorial code into a main.cpp file, then changed the build options for both compile targets.  I picked out both the search directories, and added the libraries to the linker in the right order. When I go to compile however I get the following errors concerning Shader.cpp and libGlew

||=== FukIt, Steamcrawlers ===|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::bind(sf::Shader const*)':|
Shader.cpp|| undefined reference to `__glewUseProgramObjectARB'
|
Shader.cpp|| undefined reference to `__glewUseProgramObjectARB'|
Shader.cpp|| undefined reference to `__glewUniform1iARB'
|
Shader.cpp|| undefined reference to `__glewActiveTextureARB'|
Shader.cpp|| undefined reference to `__glewActiveTextureARB'
|
Shader.cpp|| undefined reference to `__glewUniform1iARB'|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::isAvailable()'
:|
Shader.cpp|| undefined reference to `__GLEW_ARB_shading_language_100'|
Shader.cpp|| undefined reference to `__GLEW_ARB_shader_objects'
|
Shader.cpp|| undefined reference to `__GLEW_ARB_vertex_shader'|
Shader.cpp|| undefined reference to `__GLEW_ARB_fragment_shader'
|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::bindTextures() const':|
Shader.cpp|| undefined reference to `__glewUniform1iARB'
|
Shader.cpp|| undefined reference to `__glewActiveTextureARB'|
Shader.cpp|| undefined reference to `__glewActiveTextureARB'
|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::compile(char const*, char const*)':|
Shader.cpp|| undefined reference to `__GLEW_ARB_shading_language_100'
|
Shader.cpp|| undefined reference to `__GLEW_ARB_shader_objects'|
Shader.cpp|| undefined reference to `__GLEW_ARB_vertex_shader'
|
Shader.cpp|| undefined reference to `__GLEW_ARB_fragment_shader'|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'
|
Shader.cpp|| undefined reference to `__glewCreateProgramObjectARB'|
Shader.cpp|| undefined reference to `__glewCreateShaderObjectARB'
|
Shader.cpp|| undefined reference to `__glewShaderSourceARB'|
Shader.cpp|| undefined reference to `__glewCompileShaderARB'
|
Shader.cpp|| undefined reference to `__glewGetObjectParameterivARB'|
Shader.cpp|| undefined reference to `__glewAttachObjectARB'
|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'|
Shader.cpp|| undefined reference to `__glewCreateShaderObjectARB'
|
Shader.cpp|| undefined reference to `__glewShaderSourceARB'|
Shader.cpp|| undefined reference to `__glewCompileShaderARB'
|
Shader.cpp|| undefined reference to `__glewGetObjectParameterivARB'|
Shader.cpp|| undefined reference to `__glewAttachObjectARB'
|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'|
Shader.cpp|| undefined reference to `__glewLinkProgramARB'
|
Shader.cpp|| undefined reference to `__glewGetObjectParameterivARB'|
Shader.cpp|| undefined reference to `glFlush'
|
Shader.cpp|| undefined reference to `__glewGetInfoLogARB'|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'
|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'|
Shader.cpp|| undefined reference to `__glewGetInfoLogARB'
|
Shader.cpp|| undefined reference to `__glewGetInfoLogARB'|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'
|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::~Shader()':|
Shader.cpp|| undefined reference to `__glewDeleteObjectARB'
|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::getParamLocation(std::string const&)':|
Shader.cpp|| undefined reference to `__glewGetUniformLocationARB'
|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::setParameter(std::string const&, sf::Transform const&)':|
Shader.cpp|| undefined reference to `__glewGetHandleARB'
|
Shader.cpp|| undefined reference to `__glewUseProgramObjectARB'|
Shader.cpp|| undefined reference to `__glewUniformMatrix4fvARB'
|
Shader.cpp|| undefined reference to `__glewUseProgramObjectARB'|
/home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a(Shader.cpp.o)||In function `sf::Shader::setParameter(std::string const&, float, float, float, float)'
:|
Shader.cpp|| undefined reference to `__glewGetHandleARB'|
Shader.cpp|| undefined reference to `__glewUseProgramObjectARB'
|
Shader.cpp|| undefined reference to `__glewUniform4fARB'|
Shader.cpp|| undefined reference to `__glewUseProgramObjectARB'
|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 7 seconds) ===|
 

Here is my compile line from Code::Blocks
g++ -Wall -DSFML_STATIC  -O2    -I/home/codyethanjordan/Desktop/Design/SFML-master/include  -c /home/codyethanjordan/Desktop/Design/FukIt/main.cpp -o obj/Release/main.o
g++ -L/home/codyethanjordan/Desktop/Design/SFML-master/lib  -o bin/Release/FukIt obj/Release/main.o   -s  /home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-graphics-s.a /home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-window-s.a /home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-system-s.a /home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-audio-s.a /home/codyethanjordan/Desktop/Design/SFML-master/lib/libsfml-network-s.a

I'm using g++ on Fedora linux.

Thanks for reading.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Starting SFML - Problem with Code::Blocks and libGlew
« Reply #1 on: September 01, 2013, 12:49:18 am »
You might want to read a bit on static linkage. ;)
If you link statically, you have to link all of SFML's dependencies manually and statically as well in your final application.

Btw. the network and audio module are also based on the system module, thus you'll have to list the system module after the network and audio module when linking.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kashlavor

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Starting SFML - Problem with Code::Blocks and libGlew
« Reply #2 on: September 01, 2013, 08:13:51 am »
Thanks for the advice, now I can get working.

 

anything