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

Author Topic: Errors trying to #include <SFML/Audio.hpp> in ubuntu  (Read 7429 times)

0 Members and 1 Guest are viewing this topic.

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« on: May 04, 2011, 01:17:36 pm »
If I try to #include <SFML/Audio.hpp> in my program, I get the following compilation errors in Ubuntu 11.04 (SFML 1.6):

Code: [Select]
g++ -c  "/home/simon/dev/slade/trunk/src/Archive.cpp" -O3 -I/usr/local/lib/wx/include/gtk2-unicode-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -DNO_AUDIERE -DBOOL=int -DTRUE=1 -DFALSE=0 -D_7ZIP_ST -D__WX__ -DNDEBUG  -o ./Release/src_Archive.o -I.
In file included from /usr/local/include/SFML/Audio/SoundStream.hpp:31:0,
                 from /usr/local/include/SFML/Audio/Music.hpp:31,
                 from /usr/local/include/SFML/Audio.hpp:34,
                 from /home/simon/dev/slade/trunk/src/AudioEntryPanel.h:6,
                 from /home/simon/dev/slade/trunk/src/ArchivePanel.cpp:46:
/usr/local/include/SFML/Audio/Sound.hpp:52:10: error: expected identifier before ‘int’
/usr/local/include/SFML/Audio/Sound.hpp:53:5: error: expected unqualified-id before ‘{’ token
In file included from /usr/local/include/SFML/Audio/Music.hpp:31:0,
                 from /usr/local/include/SFML/Audio.hpp:34,
                 from /home/simon/dev/slade/trunk/src/AudioEntryPanel.h:6,
                 from /home/simon/dev/slade/trunk/src/ArchivePanel.cpp:46:
/usr/local/include/SFML/Audio/SoundStream.hpp:48:18: error: expected unqualified-id before ‘int’
/usr/local/include/SFML/Audio/SoundStream.hpp:48:18: error: expected ‘;’ before ‘int’
/usr/local/include/SFML/Audio/SoundStream.hpp:48:18: error: declaration does not declare anything
/usr/local/include/SFML/Audio/SoundStream.hpp:49:18: error: no members matching ‘sf::Sound::Stopped’ in ‘class sf::Sound’
/usr/local/include/SFML/Audio/SoundStream.hpp:50:18: error: no members matching ‘sf::Sound::Paused’ in ‘class sf::Sound’
/usr/local/include/SFML/Audio/SoundStream.hpp:51:18: error: no members matching ‘sf::Sound::Playing’ in ‘class sf::Sound’
g++ -c  "/home/simon/dev/slade/trunk/src/ArchiveEntry.cpp" -O3 -I/usr/local/lib/wx/include/gtk2-unicode-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -DNO_AUDIERE -DBOOL=int -DTRUE=1 -DFALSE=0 -D_7ZIP_ST -D__WX__ -DNDEBUG  -o ./Release/src_ArchiveEntry.o -I.
make[1]: *** [Release/src_ArchivePanel.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/simon/dev/slade/trunk'
make: *** [All] Error 2


Any idea what could be wrong here? I've tried both the sfml-dev package on the repository and compiling sfml manually but both do the same thing.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #1 on: May 04, 2011, 02:13:31 pm »
May I ask why you posted in "General" instead of "Audio", given that your problem is clearly related to the audio module?

I'm just trying to understand why more and more users post in the "general" sections of the forums instead of the dedicated ones -- is it just laziness, or something on the forum that is not clear enough?

Anyway, back to your problem, it's the same problem as here:
http://www.sfml-dev.org/forum/viewtopic.php?t=2675

And apparently no solution was found. this is most likely a name conflict -- something (another library, Linux headers, ...) might define a macro named Status, for example.
Laurent Gomila - SFML developer

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #2 on: May 04, 2011, 02:46:29 pm »
I posted it in general because it seemed like a platform-related issue rather than audio.

Upon further investigation it isn't actually audio related at all - the same kind of thing happens when trying to #include <SFML/Graphics.hpp>, but with a different enumerator.

I tried compiling a minimal SFML application using a RenderWindow and it worked fine, so it's apparently some conflict with either wxWidgets or my project settings.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #3 on: May 04, 2011, 02:52:29 pm »
Quote
I posted it in general because it seemed like a platform-related issue rather than audio.

Ok I see.

Quote
Upon further investigation it isn't actually audio related at all - the same kind of thing happens when trying to #include <SFML/Graphics.hpp>, but with a different enumerator.

Interesting, can you show me the error message please?
Laurent Gomila - SFML developer

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #4 on: May 04, 2011, 02:54:27 pm »
This is the error I get with Graphics.hpp:

Code: [Select]
g++ -c  "/home/simon/dev/slade/trunk/src/GfxEntryPanel.cpp" -O3 -I/usr/local/lib/wx/include/gtk2-unicode-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -DNO_AUDIERE -DBOOL=int -DTRUE=1 -DFALSE=0 -D_7ZIP_ST -D__WX__ -DNDEBUG  -o ./Release/src_GfxEntryPanel.o -I.
In file included from /usr/include/SFML/Window/Window.hpp:37:0,
                 from /usr/include/SFML/Window.hpp:37,
                 from /usr/include/SFML/Graphics.hpp:32,
                 from /home/simon/dev/slade/trunk/src/OGLCanvas.h:8,
                 from /home/simon/dev/slade/trunk/src/PaletteCanvas.h:5,
                 from /home/simon/dev/slade/trunk/src/PaletteDialog.h:5,
                 from /home/simon/dev/slade/trunk/src/PaletteDialog.cpp:35:
/usr/include/SFML/Window/WindowStyle.hpp:39:9: error: expected identifier before numeric constant
/usr/include/SFML/Window/WindowStyle.hpp:39:9: error: expected ‘}’ before numeric constant
/usr/include/SFML/Window/WindowStyle.hpp:39:9: error: expected unqualified-id before numeric constant
/usr/include/SFML/Window/WindowStyle.hpp:48:1: error: expected declaration before ‘}’ token


Perhaps important to note is that I'm using wxWidgets 2.9.2 from their svn - 2.9.1 doesn't behave correctly in ubuntu 11.04. It works fine in windows+vs2010 with wx 2.9.1.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #5 on: May 04, 2011, 03:31:03 pm »
This one is known: XLib.h defines a macro named "None", which conflicts with sf::Style::None.

Basically, to avoid problems, you must make sure that you always include SFML headers first.
Laurent Gomila - SFML developer

sirjuddington

  • Newbie
  • *
  • Posts: 13
    • View Profile
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #6 on: May 04, 2011, 05:42:55 pm »
Ah I see. I can't actually rearrange my includes in that way with how I've set things out, but #undef-ing Status and None before the related SFML includes did the trick.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Errors trying to #include <SFML/Audio.hpp> in ubuntu
« Reply #7 on: May 04, 2011, 05:52:03 pm »
Great.

It's really a shame that such popular libraries (wxWidgets and XLib) pollute the global namespace with this kind of macros.
Laurent Gomila - SFML developer