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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DarK_DemoN

Pages: [1]
1
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 10:40:51 pm »
Yeh i understand that now. I tried ogg after seeing a reference to it in the tutorials.

So i have everything working working now, thank you all for your help

2
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 08:32:57 am »
EDIT: Ok i fixed it!! The song had to be in .ogg file format because its a compressed audio type i guess. (could have sworn i thought i could use .mp3 but oh well).

Anyway thank you all for your help, i really appreciated it :D

3
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 07:33:05 am »
yes its in my project folder and the music folder name is "Music", exactly as i spelled it in my code.

Are there any other settings i need to mess with?

4
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 07:01:35 am »
EDIT: Ok once i figured out (actually a guess but lets move on) to add "-lsfml-audio" to my linker settings and copying and pasting the necassary (haha cant spell) dll files to the project folder it finally compiled!! but now i get this:

Failed to open "Music\NLTT.mp3" for reading

This is my "LoadFromFile code:

Code: [Select]

if (!Music.OpenFromFile("Music\\NLTT.mp3"))
        return EXIT_FAILURE;


It should load so i dont know why this is appearing and i have gone back through everything to make sure the file paths are correct and everything is fine.

HELP!!!!

Please ;D

5
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 06:34:58 am »
[/img]

6
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 05:56:59 am »
I checked and everything is setup correctly according to the tutorials.

What else could it be? I even googled one of the errors and didnt find anything

7
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 05:25:50 am »
My code is the same as the one you posted and i get the errors.

Yes i used the music.cpp file as a template and when i compile that project i get the same exact errors as my code/the code you posted.

I honestly have no idea what is wrong. And its very strange that im getting the same errors that i get in my code as the ones i get using the sample. And i would have thought that since its a sample code everything should be correct and working in it.

Thank you for spending your time trying to help me i really appreciate it.

8
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 03:30:16 am »
@Terrydil

Idid what you said (which ive done a million times before) and i get these errors:

Code: [Select]

undefined reference to `sf::Music::Music(unsigned int)'|
undefined reference to `sf::Music::OpenFromFile(std::string const&)'|
undefined reference to `sf::Music::GetDuration() const'|
undefined reference to `sf::SoundStream::GetSampleRate() const'|
undefined reference to `sf::SoundStream::GetChannelsCount() const'|
undefined reference to `sf::SoundStream::Play()'|
undefined reference to `sf::SoundStream::GetStatus() const'|
undefined reference to `sf::Music::~Music()'|
undefined reference to `sf::Music::~Music()'|
||=== Build finished: 9 errors, 0 warnings ===|


All i am trying to accomplish is getting music (NLTT.mp3) to play while my program is running. I know how to program in C++ fairly well so i do know my way around code and how to code.

One of my friends has tried to help with this issue and couldnt figure it out either and he has alot more expirience in SFML than i do so it isnt just me.

Please help

Thank you

9
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 02:09:21 am »
Ok im having some trouble playing music. Ive tried everything and im not sure how to fix it.

Code: [Select]

#include <iostream>
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <sstream>

using namespace std;
using namespace sf;

int main()
{

    sf::Music Music;

    if (!Music.OpenFromFile("Music\\NLTT.mp3"))
        return EXIT_FAILURE;

    std::cout << "NLTT.mp3: " << std::endl;
    std::cout << " " << Music.GetDuration()      << " sec"           << std::endl;
    std::cout << " " << Music.GetSampleRate()    << " samples / sec" << std::endl;
    std::cout << " " << Music.GetChannelsCount() << " channels"      << std::endl;


    sf::Music::Music();
    bool sf::Music::OpenFromFile(const std::string&)
    sf::Music::GetDuration() const
    sf::SoundStream::GetSampleRate() const
    sf::SoundStream::GetChannelsCount() const
    sf::SoundStream::Play()
    sf::Sound::Status
    sf::SoundStream::GetStatus() const
    sf::Music::~Music()

    Music.Play();
    std::cout << "Playing..." << std::endl;


    while (Music.GetStatus() == sf::Music::Playing)
    {
        sf::Sleep(0.1f);
    }
    std::cout << std::endl;

    std::cin.ignore(10000, '\n');
    return EXIT_SUCCESS;

}
    return 0;
}


This is the error:

In function 'int main()':
|21|error: expected initializer before 'sf'|
||=== Build finished: 1 errors, 0 warnings ===|


The error is pointing to this line:
Code: [Select]
sf::Music::GetDuration() const

Im not sure what is wrong but if anyone could help me it would be appreciated.

Thanks!

10
Graphics / sf::String and int
« on: January 08, 2011, 07:00:59 am »
Here is what i tried:

Code: [Select]

#include <iostream>
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <sstream>

using namespace std;


int main()
{
    sf::RenderWindow App(sf::VideoMode(400,100,16), "Calculator - By: DarK_DemoN");

    sf::Font MyFont;
    if (!MyFont.LoadFromFile("Fonts\\AdamFont.ttf"))
        return EXIT_FAILURE;

    int a;
    int b;
    int c;
    std::stringstream stream;
    sf::String Output("Please enter a number: ");
    sf::String InputStr;

    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            const sf::Input& Input = App.GetInput();
            if (Event.Type ==sf::Event::Closed )
                App.Close();

            if (Input.IsKeyDown(sf::Key::Escape))
                App.Close();

            if (Event.Type == sf::Event::TextEntered)
            {
                if (Event.Text.Unicode < 256)
                {
                    a += static_cast<char>(Event.Text.Unicode);
                    stream << a;
                }
            }
            InputStr.SetText(stream.str());

    }

}

 App.Draw(Output);
 App.Draw(InputStr);

 App.Display();
    }
    return 0;
}


It doesnt produce any errors but it is VERY unstable. When the window appears after compiling i cant enter in any numbers and after a couple of seconds it stops responding. Its either it does that or right after its done compiling i get a see-through window (no BG color, no text, nothing).

Please help

11
Graphics / sf::String and int
« on: January 07, 2011, 06:35:16 am »
Hi i have a question on why i cannot set a sf::String to the value of an int.

Any help would be appreciated :D

Pages: [1]
anything