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

Author Topic: Can't compile code, 'class sf::X' has no member named 'Y'  (Read 5250 times)

0 Members and 1 Guest are viewing this topic.

Zephilinox

  • Newbie
  • *
  • Posts: 43
    • View Profile
Can't compile code, 'class sf::X' has no member named 'Y'
« on: March 12, 2012, 11:16:34 pm »
I've recently moved to ubuntu from windows, in windows I could get SFML working but I can't seem to get it working in ubuntu, I'm pretty sure I made it [sfml 2.0] properly so it must be a linker/compiler problem.

I'm using codeblocks.

I'm trying to compile this:

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "SFML Sample Application");

while (Window.IsOpen())
{
sf::Event Event;
while (Window.PollEvent(Event))
{
switch (Event.Type)
{
case sf::Event::Closed:
Window.Close();
break;
default:
break;
}
}

Window.Clear(sf::Color(0, 255, 255));
Window.Display();
}

return 0;
}



with static libraries, in settings>compiler>global compiler>search directories>compiler I have "/home/z/Programming/sfml2/include" and in settings>compiler>global compiler>search directories>linker I have "/home/z/Programming/sfml2/lib", in settings>compiler>global compiler>compiler settings>#defines I have "SFML_STATIC".

then in my project build options, I have this in debug>linker settings>link libraries

Code: [Select]

sfml-graphics-s-d
sfml-audio-s-d
sfml-window-s-d
sfml-network-s-d
sfml-system-s-d


and I have this in release>linker settings>link libraries

Code: [Select]

sfml-graphics-s
sfml-audio-s
sfml-window-s
sfml-network-s
sfml-system-s


Am I missing something? these are the errors I'm getting:

Code: [Select]

/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp||In function ‘int main()’:|
/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp|7|error: ‘class sf::RenderWindow’ has no member named ‘IsOpen’|
/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp|10|error: ‘class sf::RenderWindow’ has no member named ‘PollEvent’|
/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp|12|error: ‘class sf::Event’ has no member named ‘Type’|
/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp|15|error: ‘class sf::RenderWindow’ has no member named ‘Close’|
/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp|22|error: ‘class sf::RenderWindow’ has no member named ‘Clear’|
/media/Storage/Programming/C++/Real Projects/SFML/SFML START 1[LINUX]/main.cpp|23|error: ‘class sf::RenderWindow’ has no member named ‘Display’|
||=== Build finished: 6 errors, 0 warnings ===|

frosty

  • Newbie
  • *
  • Posts: 13
    • View Profile
Can't compile code, 'class sf::X' has no member named 'Y'
« Reply #1 on: March 12, 2012, 11:25:32 pm »
In the latest version (as of this past weekend), the naming conventions have changed: everything is now camelCase. For example, "IsOpen" is now "isOpen".

See this thread: http://www.sfml-dev.org/forum/viewtopic.php?t=6709

You'll need to adjust your code accordingly. Most online tutorials etc are out of date now, but you can compare your code to the official documentation (which is kept up to date): http://www.sfml-dev.org/documentation/2.0/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't compile code, 'class sf::X' has no member named 'Y'
« Reply #2 on: March 12, 2012, 11:34:27 pm »
Don't use static libraries on Linux, it will make things more complicated for you. Static libraries are useful only on Windows, other OSes manage shared libraries really well.
Laurent Gomila - SFML developer

Zephilinox

  • Newbie
  • *
  • Posts: 43
    • View Profile
Can't compile code, 'class sf::X' has no member named 'Y'
« Reply #3 on: March 12, 2012, 11:35:54 pm »
ugh camelCase... thanks, that fixed that, but now I get this..

edit: alright, I'll try it with dynamic.

Code: [Select]

/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `_ZN2sf12RenderTarget13resetGLStatesEv.part.2':|
RenderTarget.cpp|| undefined reference to `glDisable'|
RenderTarget.cpp|| undefined reference to `glDisable'|
RenderTarget.cpp|| undefined reference to `glEnable'|
RenderTarget.cpp|| undefined reference to `glEnable'|
RenderTarget.cpp|| undefined reference to `glEnable'|
RenderTarget.cpp|| undefined reference to `glAlphaFunc'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glEnableClientState'|
RenderTarget.cpp|| undefined reference to `glEnableClientState'|
RenderTarget.cpp|| undefined reference to `glEnableClientState'|
RenderTarget.cpp|| undefined reference to `__GLEW_EXT_blend_func_separate'|
RenderTarget.cpp|| undefined reference to `__glewBlendFuncSeparateEXT'|
RenderTarget.cpp|| undefined reference to `glLoadMatrixf'|
RenderTarget.cpp|| undefined reference to `glBindTexture'|
RenderTarget.cpp|| undefined reference to `__glewUseProgramObjectARB'|
RenderTarget.cpp|| undefined reference to `glBlendFunc'|
/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::clear(sf::Color const&)':|
RenderTarget.cpp|| undefined reference to `glClearColor'|
/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::pushGLStates()':|
RenderTarget.cpp|| undefined reference to `glPushAttrib'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glPushMatrix'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glPushMatrix'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glPushMatrix'|
/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::popGLStates()':|
RenderTarget.cpp|| undefined reference to `glPopAttrib'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glPopMatrix'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glPopMatrix'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::applyCurrentView()':|
RenderTarget.cpp|| undefined reference to `glViewport'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
RenderTarget.cpp|| undefined reference to `glLoadMatrixf'|
RenderTarget.cpp|| undefined reference to `glMatrixMode'|
/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::draw(sf::Vertex const*, unsigned int, sf::PrimitiveType, sf::RenderStates const&)':|
RenderTarget.cpp|| undefined reference to `__GLEW_EXT_blend_func_separate'|
RenderTarget.cpp|| undefined reference to `__glewBlendFuncSeparateEXT'|
RenderTarget.cpp|| undefined reference to `glVertexPointer'|
RenderTarget.cpp|| undefined reference to `glColorPointer'|
RenderTarget.cpp|| undefined reference to `glTexCoordPointer'|
RenderTarget.cpp|| undefined reference to `glDrawArrays'|
RenderTarget.cpp|| undefined reference to `__glewUseProgramObjectARB'|
RenderTarget.cpp|| undefined reference to `glLoadMatrixf'|
RenderTarget.cpp|| undefined reference to `glBlendFunc'|
RenderTarget.cpp|| undefined reference to `glLoadMatrixf'|
RenderTarget.cpp|| undefined reference to `glBlendFunc'|
RenderTarget.cpp|| undefined reference to `glBlendFunc'|
RenderTarget.cpp|| undefined reference to `glBindTexture'|
RenderTarget.cpp|| undefined reference to `glBlendFunc'|
/home/z/Programming/sfml2/lib/libsfml-graphics-s.a(RenderTarget.cpp.o)||In function `sf::RenderTarget::applyBlendMode(sf::BlendMode)':|
RenderTarget.cpp|| undefined reference to `__GLEW_EXT_blend_func_separate'|
RenderTarget.cpp|| undefined reference to `__glewBlendFuncSeparateEXT'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Zephilinox

  • Newbie
  • *
  • Posts: 43
    • View Profile
Can't compile code, 'class sf::X' has no member named 'Y'
« Reply #4 on: March 12, 2012, 11:50:47 pm »
Dynamic libraries seem to work, thanks :D

 

anything