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 - Roggie

Pages: [1]
1
General / Re: [XCODE] SFML Command Line Tool template doesn't work?
« on: April 02, 2013, 11:53:11 am »
I'm sorry for triple-posting, but I guess this is worth a new post c:

It turned out that the search path for the dylib was missing. This is the first time I'm doing this kind of stuff, so I forgot to look there. :x Anyways, the application doesn't give any linker errors anymore!

Thing is, the error now changed to an error with 64-bit architecture from what I can read. The full error:
Undefined symbols for architecture x86_64:
  "sf::RenderWindow::RenderWindow(sf::VideoMode, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main.o
  "sf::Font::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main.o
  "sf::Music::openFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main.o
  "sf::String::String(char const*, std::__1::locale const&)", referenced from:
      _main in main.o
  "sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
 
The code I'm using:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>

/* Resources :
 * ===========
 *
 * In order to load the resources like cute_image.png, you have to set up
 * your target scheme :
 *
 * - Select "Edit Schemeā€¦" in the "Product" menu;
 * - Check the box "use custom working directory";
 * - Fill the text field with the folder path containing your resources;
 *        (e.g. your project folder)
 * - Click OK.
 */

 

int main (int argc, const char * argv[])
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Texture texture;
    if (!texture.loadFromFile("cute_image.jpg"))
        return EXIT_FAILURE;
    sf::Sprite sprite(texture);

    // Create a graphical text to display
    sf::Font font;
    if (!font.loadFromFile("sansation.ttf"))
        return EXIT_FAILURE;
    sf::Text text("Hello SFML", font, 50);
    text.setColor(sf::Color::Black);

    // Load a music to play
    sf::Music music;
    if (!music.openFromFile("nice_music.ogg"))
        return EXIT_FAILURE;

    // Play the music
    music.play();
       

    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
                // Close window : exit
                if (event.type == sf::Event::Closed)
                        window.close();
           
                // Escape pressed : exit
                if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
                        window.close();
        }

        // Clear screen
        window.clear();
       
        // Draw the sprite
        window.draw(sprite);
       
        // Draw the string
        window.draw(text);

        // Update the window
        window.display();
    }

        return EXIT_SUCCESS;
}
 
(just the template)

Edit:

Whenever I change C++11 to C++98, I get a whole new set of errors that might be worth looking at. It doesn't stop the program, but it does give some nice output:

dyld: lazy symbol binding failed: Symbol not found: __ZN2sf12RenderWindowC1ENS_9VideoModeERKSsjRKNS_15ContextSettingsE
  Referenced from: /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Command_Edited_Linkers-czmimcgihsgwemdzuixoxdhtjwmt/Build/Products/Release/SFML Command Edited Linkers
  Expected in: /Library/Frameworks/sfml-graphics.framework/Versions/2.0.0/sfml-graphics

dyld: Symbol not found: __ZN2sf12RenderWindowC1ENS_9VideoModeERKSsjRKNS_15ContextSettingsE
  Referenced from: /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Command_Edited_Linkers-czmimcgihsgwemdzuixoxdhtjwmt/Build/Products/Release/SFML Command Edited Linkers
  Expected in: /Library/Frameworks/sfml-graphics.framework/Versions/2.0.0/sfml-graphics

Edit 2:

When I switch to the non-commandline tool SFML template and I change the C++11 compiler to the C++98 compiler it does work? It leaves me with two problems:
objc[8081]: Class SFApplication is implemented in both /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Take_3-gxmsbcnyicaawxebvcbqdrugleup/Build/Products/Release/SFML Take 3.app/Contents/Frameworks/sfml-window.framework/Versions/2.0.0/sfml-window and /usr/local/lib/libsfml-window.2.dylib. One of the two will be used. Which one is undefined.
objc[8081]: Class SFOpenGLView is implemented in both /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Take_3-gxmsbcnyicaawxebvcbqdrugleup/Build/Products/Release/SFML Take 3.app/Contents/Frameworks/sfml-window.framework/Versions/2.0.0/sfml-window and /usr/local/lib/libsfml-window.2.dylib. One of the two will be used. Which one is undefined.
objc[8081]: Class SFWindow is implemented in both /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Take_3-gxmsbcnyicaawxebvcbqdrugleup/Build/Products/Release/SFML Take 3.app/Contents/Frameworks/sfml-window.framework/Versions/2.0.0/sfml-window and /usr/local/lib/libsfml-window.2.dylib. One of the two will be used. Which one is undefined.
objc[8081]: Class SFWindowController is implemented in both /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Take_3-gxmsbcnyicaawxebvcbqdrugleup/Build/Products/Release/SFML Take 3.app/Contents/Frameworks/sfml-window.framework/Versions/2.0.0/sfml-window and /usr/local/lib/libsfml-window.2.dylib. One of the two will be used. Which one is undefined.
objc[8081]: Class SFViewController is implemented in both /Users/matthijs/Library/Developer/Xcode/DerivedData/SFML_Take_3-gxmsbcnyicaawxebvcbqdrugleup/Build/Products/Release/SFML Take 3.app/Contents/Frameworks/sfml-window.framework/Versions/2.0.0/sfml-window and /usr/local/lib/libsfml-window.2.dylib. One of the two will be used. Which one is undefined.
 
This is the output I get when I compile it as a default SFML program. It seems like it has something to do with the fact that I've got like two or three copies of the dylibs. Will this cause problems in the future?

And my second problem: does anybody have a solution to the problems I'm facing with he command-line tool template? I really want to use it...

2
General / Re: [XCODE] Those Templates Are Driving Me Crazy!
« on: April 01, 2013, 04:38:48 pm »
I just noticed that when installing sfml on linux, you have to download a package called lsfml. Does this mean the installer didn't install lsfml properly?

3
General / [XCODE] Command Line Tool template doesn't work?
« on: April 01, 2013, 11:22:17 am »
Hi,

I've been scrolling through Google and this forum for days now, but SFML just seems to be refusing to work in my Macbook Air, even though it works well on my PC with Visual Studio 2012. According to the template topic in General, the Xcode templates have been updated to what would be Xcode 4.6. However, they just won't work with me. Whenever I try to compile a SFML program (either normal program, or program with console command), I get the following linker error:
ld: library not found for -lsfml-system-d
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It calls itself an Apple Mach-O Linker (Id) Error. Whenever I add the framework in the project wizard, it gives me the well-known SFML/Graphics.hpp not found error.

I've also tried compiling from scratch with CMake, but this gives some errors and I can't seem to find a proper fix. If anybody knows how to get this templates working, or has got some recent instructions (the ones I didn't seem to be able to find) could you please give them? :3

By the way, I'm using SFML 2.0. I do not know whether I'm using static or dynamic, I just compiled the template without even touching the code.

Roggie

4
General discussions / Re: Xcode templates updated
« on: March 29, 2013, 02:56:39 pm »
Thanks! I stopped using SFML because I was such a failure with the whole manual compilation stuff, but now I can start again! I've been having one error though: clang: error: linker command failed with exit code 1 (use -v to see invocation). I've searched for it, and it seems I have to do something with recompilation?

I don't know if I should make I new topic for this under general, but you asked for bugs in the templates and I think this has something to do with the template :3

5
General / Re: SFML XCode 4 Template Without SFML?
« on: October 17, 2012, 08:16:05 pm »
Have I done what? :P

I'm sorry, but I'm not that of a wonder with all these extra programs and compilers. I often just download the installer (if there's one), follow a couple of tuts and then make something. Could you maybe explain it? :3

6
General / SFML XCode 4 Template Without SFML?
« on: October 17, 2012, 07:54:24 pm »
Yo!

After some time of absence in the SFML-world I decided to just start over and try again. Full of enthusiasm, I started up my updated Xcode and ran the standard SFML 2.0 template. SFML/Graphics.hpp not found Well, I didn't see the SFML folder at all in the frameworks folder so I thought I had accidentally deleted it. I ran the 2.0 installer and stated a new project trough the template. SFML/Graphics.hpp not found. And, again I couldn't find the SFML folder in the frameworks, so I added it by dragging it from the Finder. No response but the error. Does anybody know this?

Roggie

7
Graphics / Re: [SFML2.0] Drawing multiple instances of one sprite
« on: June 28, 2012, 10:12:46 am »
Well, I guess I tried to do it in the wrong way then, because I did try this:
Quote
    sf::Texture squaretex;
    if (!squaretex.loadFromFile(resourcePath() + "square.gif"))
        return EXIT_FAILURE;
    sf::Sprite sprsquare;
    sprsquare.setTexture(squaretex);
    sprsquare.setColor(sf::Color(255, 255, 255, 200));
    sprsquare.setPosition(0, 0);

//loads of code here

    while (window.isOpen())
    {
       // Process events
       sf::Event event;
       while (window.pollEvent(event))
       {
          // Close window : exit
          if (event.type == sf::Event::Closed)
             window.close();
           
          // Escape pressed : exit
          if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
             window.close();
       }
       
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
            sprcircle.move(-1,0);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
            sprcircle.move(1,0);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
            sprcircle.move(0,-1);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
            sprcircle.move(0,1);
        }

       // Clear screen
       window.clear();
       
       // Draw the sprite
       window.draw(sprite);
        window.draw(sprcircle);
        window.draw(sprsquare);   
        sprsquare.setPosition(32, 0);
        window.draw(sprsquare);

       // Update the window
       window.display();
    }

   return EXIT_SUCCESS;
}

Anyways, thank you!

8
Graphics / [SFML2.0] Drawing multiple instances of one sprite
« on: June 28, 2012, 08:39:35 am »
Hello!

I'm a beginner to SFML, and I've just learned to draw a sprite in 2.0 . Now I can move it with my arrow keys (which I'm very proud of :3), I'd like to draw another sprite. I loaded the second sprite (a square) the same way as I did with the first sprite (a circle) and set the position to 0,0. So far so good. Then, I drew it, and succeeded in doing that as well. After that, I wanted to draw multiple instances of that one sprite, but couldn't find a way to. Is the only way to do this by making hundreds of sprites (sprsquare1, sprsquare2, sprsquare45, etc.) or is there any way of drawing the same sprite on different places?

Roggie

Pages: [1]
anything