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

Author Topic: Compilation errors  (Read 15158 times)

0 Members and 2 Guests are viewing this topic.

orm

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation errors
« on: May 30, 2010, 08:49:07 pm »
Don't know what it is. I have checked the headers myself and everything liooks good as far as I can tell.

Code: [Select]
In file included from /usr/include/SFML/Audio/SoundStream.hpp:31:0,                                                                                                  
                 from /usr/include/SFML/Audio/Music.hpp:31,
                 from /usr/include/SFML/Audio.hpp:34,
                 from /home/orm/Engine-CL/theengine/../osound/OSoundCommon.h:18,
                 from /home/orm/Engine-CL/theengine/../osound/OSound.h:13,
                 from /home/orm/Engine-CL/theengine/Engine2DCommon.h:16,
                 from /home/orm/Engine-CL/theengine/Application.h:5,
                 from /home/orm/Engine-CL/theengine/Application.cpp:1:
/usr/include/SFML/Audio/Sound.hpp:52:10: error: expected identifier before ‘int’
/usr/include/SFML/Audio/Sound.hpp:53:5: error: expected unqualified-id before ‘{’ token
In file included from /usr/include/SFML/Audio/Music.hpp:31:0,
                 from /usr/include/SFML/Audio.hpp:34,
                 from /home/orm/Engine-CL/theengine/../osound/OSoundCommon.h:18,
                 from /home/orm/Engine-CL/theengine/../osound/OSound.h:13,
                 from /home/orm/Engine-CL/theengine/Engine2DCommon.h:16,
                 from /home/orm/Engine-CL/theengine/Application.h:5,
                 from /home/orm/Engine-CL/theengine/Application.cpp:1:
/usr/include/SFML/Audio/SoundStream.hpp:48:18: error: expected unqualified-id before ‘int’
/usr/include/SFML/Audio/SoundStream.hpp:48:18: error: expected ‘;’ before ‘int’
/usr/include/SFML/Audio/SoundStream.hpp:48:18: error: declaration does not declare anything
/usr/include/SFML/Audio/SoundStream.hpp:49:18: error: no members matching ‘sf::Sound::Stopped’ in ‘class sf::Sound’
/usr/include/SFML/Audio/SoundStream.hpp:50:18: error: no members matching ‘sf::Sound::Paused’ in ‘class sf::Sound’
/usr/include/SFML/Audio/SoundStream.hpp:51:18: error: no members matching ‘sf::Sound::Playing’ in ‘class sf::Sound’
make[2]: *** [CMakeFiles/Engine2D.dir/theengine/Application.o] Error 1
make[1]: *** [CMakeFiles/Engine2D.dir/all] Error 2
make: *** [all] Error 2


I am using the current package available in the ArchLinux repositories and am linking with sfml-system and sfml-audio in that order.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Compilation errors
« Reply #1 on: May 30, 2010, 10:50:10 pm »
Which version of SFML is it?
Laurent Gomila - SFML developer

orm

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation errors
« Reply #2 on: May 30, 2010, 11:39:10 pm »
1.6-1 is the version in the AUR (Archlinux User Repository)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Compilation errors
« Reply #3 on: May 31, 2010, 08:59:47 am »
Weird, in SoundStream.hpp at line 48 I have
Code: [Select]
using Sound::Status;

And in Sound.hpp at line 52, I have
Code: [Select]
enum Status
Which seems completely unrelated to your error messages.

Do you do something special in your own headers before including SFML? Have you tried compiling a very simple application using sfml-audio, outside your engine?
Laurent Gomila - SFML developer

orm

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation errors
« Reply #4 on: May 31, 2010, 05:48:24 pm »
I would think that Status was put into the sound namespace, so it's just calling on the Status enum.

Strange though. And no, I am just including the sfml headers in a separate module of the engine. Everything is very compotenized in my framework, so the sound headers and sources only include what they need.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Compilation errors
« Reply #5 on: May 31, 2010, 06:07:52 pm »
What is your version of gcc?

Have you tried recompiling the SFML "sound" sample?
Laurent Gomila - SFML developer

orm

  • Newbie
  • *
  • Posts: 4
    • View Profile
Compilation errors
« Reply #6 on: May 31, 2010, 09:51:20 pm »
g++ is 4.5+. Latest.

Don't tell me, sfml is incompatible with latest g++?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Compilation errors
« Reply #7 on: May 31, 2010, 09:57:04 pm »
Quote
Don't tell me, sfml is incompatible with latest g++?

I don't think so. At least it works with gcc 4.4 on Windows, and so far you're the only one to report such an error. And there's really nothing complicated in these headers.
Laurent Gomila - SFML developer

kiaran

  • Newbie
  • *
  • Posts: 17
    • View Profile
Compilation errors
« Reply #8 on: July 25, 2010, 06:40:40 am »
I'm getting the exact same error on the same line when compiling the sound header.

I'm using gcc 4.4.3.

Did anyone find a solution for this? I've never even seen this compiler error before and a glance at the code doesn't suggest that anything should be wrong with it. Indeed, the same file has compiled for me with Visual Studio.

kiaran

  • Newbie
  • *
  • Posts: 17
    • View Profile
Compilation errors
« Reply #9 on: July 25, 2010, 09:14:13 am »
I've been messing with this compile error for the past three hours and I'm at my wits end here.

I think it may be a corrupted file encoding or something. Oddly, when I remove only the comments from the file, the line error jumps around from the enum Status to various functions near the end of the class definition. But apart from being on a different line, the error is always the same:

error: expected identifier before ‘int’
error: expected unqualified-id before ‘{’ token

Suspecting a missing brace in one of the header files, I commented them out completely but the error remains.

Oddly enough, changed the file encoding in Code::Blocks also cause the error line to jump around. This suggests to me that the .cpp files have been corrupted in some way. My next move is to rewrite the code into a new .cpp file but this is a LAST resort and may not even work if my theory is wrong.

Any help is greatly appreciated. My whole project compiles in linux now, it's just this silly bug that is holding up the whole project.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Compilation errors
« Reply #10 on: July 25, 2010, 10:24:56 am »
What you can do is to copy and rename the class (so that the rest still compiles), and then remove code from it line by line until the error disappears.
Laurent Gomila - SFML developer

Svenstaro

  • Full Member
  • ***
  • Posts: 222
    • View Profile
Compilation errors
« Reply #11 on: July 25, 2010, 01:46:12 pm »
SFML is in Arch Linux official repo now so you can easily get it from there (thanks to yours truly, I am just that awesome).

kiaran

  • Newbie
  • *
  • Posts: 17
    • View Profile
Compilation errors
« Reply #12 on: July 25, 2010, 08:55:50 pm »
Svenstaro - I tried SFML from the Arch linux repo. But I'm still getting the same compile error.

Laurent- I'm going try doing some surgery on the files.

This really sucks.

Svenstaro

  • Full Member
  • ***
  • Posts: 222
    • View Profile
Compilation errors
« Reply #13 on: July 25, 2010, 08:57:47 pm »
What exactly did you do? The SFML in Arch repos is binary already so what did you try to compile?

kiaran

  • Newbie
  • *
  • Posts: 17
    • View Profile
Compilation errors
« Reply #14 on: July 25, 2010, 10:43:10 pm »
I'm no expert linux programmer, but I've done a bit in the past. Maybe I'm setting things up incorrectly.

1. I include the SFML audio header into my own Audio sub-system.
2. I add the SFML/include directory to the compiler search path.
3. I place the .so libraries in my project root folder.

Compiling fails at the Sound.hpp header file.

After some experimentation, I was able to get it to compile, but only by chaning all references to the 'Status' enum and renaming it 'SoundState'. But since I only changed the headers this is giving me linker errors. It seems like a naming conflict, but I don't see how that is possible since it's inside a namespace.

So I'm still stuck here. Am setting up the build environment correctly?