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

Author Topic: Cannot find -lsfml-audio.dll  (Read 6833 times)

0 Members and 1 Guest are viewing this topic.

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Cannot find -lsfml-audio.dll
« on: March 06, 2012, 08:30:47 pm »
Cant seem to get SFML to work, im using Codeblocks compiler for C++.
I created a new SFML project using the wizard and was provided the following code(simple window).
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Image Image;
    if (!Image.LoadFromFile("cb.bmp"))
        return EXIT_FAILURE;
    sf::Sprite Sprite(Image);

// Start the game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear screen
        App.Clear();

        // Draw the sprite
        App.Draw(Sprite);

        // Update the window
        App.Display();
    }

    return EXIT_SUCCESS;
}
but upon running i get the error:
Code: [Select]
||=== Tester, Debug ===|
ld.exe||cannot find -lsfml-audio.dll|
||=== Build finished: 1 errors, 0 warnings ===|

Im not sure why though, because i clearly see the audio.dll file in the folder, and have the correct links. Any suggestions?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Cannot find -lsfml-audio.dll
« Reply #1 on: March 06, 2012, 08:39:11 pm »
Quote
I created a new SFML project using the wizard

Bad idea, this wizard simply doesn't work.

Follow the official SFML tutorial if you want to get something working.
Laurent Gomila - SFML developer

Mjonir

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Cannot find -lsfml-audio.dll
« Reply #2 on: March 06, 2012, 08:39:29 pm »
The DLL files are the files you give along with your program. What you need to link are ".a" files, in this case "libsfml-audio.a".

Also if you work on Windows, I suggest you static-link SMFL (linking "-s.a" files instead), it works better from my own experience :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Cannot find -lsfml-audio.dll
« Reply #3 on: March 06, 2012, 08:41:46 pm »
Quote
Also if you work on Windows, I suggest you static-link SMFL (linking "-s.a" files instead), it works better from my own experience

The dynamic version works exactly as good as the static one... :P
Laurent Gomila - SFML developer

Mjonir

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Cannot find -lsfml-audio.dll
« Reply #4 on: March 06, 2012, 08:46:07 pm »
Quote from: "Laurent"
Quote
Also if you work on Windows, I suggest you static-link SMFL (linking "-s.a" files instead), it works better from my own experience

The dynamic version works exactly as good as the static one... :P


I once had a problem with GDB + Code::Blocks: Whenever I tried debugging, gdb.exe crashed. GDB did not crash when used directly in a terminal, only through C::B.

I was using the dynamic debug libraries of SFML2. The problem disappeared by using the static version instead (it was a while ago, but I think I found a clue to that answer on the French SFML forum, so I was apparently not the only one who got this) :)

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Cannot find -lsfml-audio.dll
« Reply #5 on: March 07, 2012, 01:30:52 am »
so under build options how should i set up the list?
currently i use:
build options->release->linker settings->other linker options
Code: [Select]
-lsfml-audio-s
-lsfml-graphics
-lsfml-window
-lsfml-system

Mjonir

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Cannot find -lsfml-audio.dll
« Reply #6 on: March 07, 2012, 01:40:44 am »
Er, personally I use "link libraries" and give a relative path to the libraries (less portable, but much easier for me to move my stuff, I'm the only one compiling it anyway).

Anyway if you want to use "other linker options", you list looks good to ME EXCEPT that you're mixing static and dynamic libraries. It should work, but that's a bit weird to do that :o

Use either:

Code: [Select]

-lsfml-audio-s
-lsfml-graphics-s
-lsfml-window-s
-lsfml-system-s


Or:

Code: [Select]

-lsfml-audio
-lsfml-graphics
-lsfml-window
-lsfml-system


Also if you use static libraries, don't forget to use "Compiler settings -> #defines" and write there:

Code: [Select]
SFML_STATIC

geoteam

  • Newbie
  • *
  • Posts: 4
    • View Profile
cannot find -lsfml-audio.dll
« Reply #7 on: March 15, 2012, 08:04:27 pm »
I am having this same problem to and I've tried some of the earlier posts solutions but they haven't work for me can some post a step by step way to do it?

Mjonir

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Cannot find -lsfml-audio.dll
« Reply #8 on: March 15, 2012, 08:08:31 pm »
There are multiple step-by-step tutorials on the website, and I can ensure you they are correct. Just be sure to read everything and follow them to the letter :)

Sorry we can't really help you much more than this, the process is really straightforward, you must have made a mistake along the way. Don't hesitate to ask if there was something you did not understand though. If you're a bit lost, I suggest reading this recent post on the matter: http://www.sfml-dev.org/forum/viewtopic.php?p=48091&highlight=#48091