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

Author Topic: error C2039: 'Sound' : is not a member of 'sf' vc++ error  (Read 3285 times)

0 Members and 1 Guest are viewing this topic.

og_the_trog

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
error C2039: 'Sound' : is not a member of 'sf' vc++ error
« on: January 27, 2014, 02:55:22 am »
Hello Everyone
I only started using the sfml audio module today, and when I try to define a sound and compile my code, visual studio gives me an error saying "error C2039: 'Sound' : is not a member of 'sf'"

normally on vc++ it  underlines a word in red if it has found an error, but with this it only gives me an error when I compile.

I have included SFML/Audio.hpp, but indirectly, meaning I'm including a header file that's including SFML/Audio.hpp. If that means anything.

I've also added sfml-audio-d.lib as an additional dependency, in the linker properties.

another curious thing is when I try to run the example programs for sound and sound capture a window pops up saying "the program can't start because openal32 dll is missing from your computer"
perhaps that's the reason, if it is I have no idea how to fix it...

I'm using sfml 2.0, on windows 7 home premium, and compiling on microsoft visual c++ 2010 express edition

ThankYou c:

og_the_trog

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: error C2039: 'Sound' : is not a member of 'sf' vc++ error
« Reply #1 on: January 27, 2014, 06:02:38 am »
Strange, I managed to fix it, but I don't know why it had this problem to start with.
first time I defined my sf::sound in the header file, this gave me the "'Sound' : is not a member of 'sf'" error.
but when I define it in the .cpp file it works fine and as expected.

oh well I'll just have to put up with it, atleast I managed to fix it at all.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: error C2039: 'Sound' : is not a member of 'sf' vc++ error
« Reply #2 on: January 27, 2014, 06:08:33 am »
Are you sure you were including <SFML/Audio.hpp> in your header file?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: error C2039: 'Sound' : is not a member of 'sf' vc++ error
« Reply #3 on: January 27, 2014, 08:10:38 am »
Don't trust IntelliSense, it has many issues, starting at hanging itself up and ending at marking random things.

The only thing you should fully trust is the compiler and linker.

If a class declaration can't be found, then you haven't included the right header at the right position. Since it didn't work in your header, you most likely forgot to include SFML/Audio.hpp.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/