Not working on Xcode 6.1.1 with SFML 2.2

Started by juiceeYay, 08 February 2015, 20:54:02

juiceeYay

I'm following the instructions to build TGUI using frameworks. Cmake compiles and creates the framework, which I then drag into my SFML project in Xcode. Upon compilation I receive an error I don't receive before adding the TGUI framework:

Quoteobjc[55496]: Class SFApplication is implemented in both /Users/JME/Library/Frameworks/sfml-window.framework/Versions/2.2.0/sfml-window and /Users/JME/Library/Developer/Xcode/DerivedData/tguiS-ghkdqmzdojvzrwghpznehbmsntcc/Build/Products/Debug/tguiS.app/Contents/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window. One of the two will be used. Which one is undefined.
objc[55496]: Class SFOpenGLView is implemented in both /Users/JME/Library/Frameworks/sfml-window.framework/Versions/2.2.0/sfml-window and /Users/JME/Library/Developer/Xcode/DerivedData/tguiS-ghkdqmzdojvzrwghpznehbmsntcc/Build/Products/Debug/tguiS.app/Contents/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window. One of the two will be used. Which one is undefined.
objc[55496]: Class SFSilentResponder is implemented in both /Users/JME/Library/Frameworks/sfml-window.framework/Versions/2.2.0/sfml-window and /Users/JME/Library/Developer/Xcode/DerivedData/tguiS-ghkdqmzdojvzrwghpznehbmsntcc/Build/Products/Debug/tguiS.app/Contents/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window. One of the two will be used. Which one is undefined.
objc[55496]: Class SFWindow is implemented in both /Users/JME/Library/Frameworks/sfml-window.framework/Versions/2.2.0/sfml-window and /Users/JME/Library/Developer/Xcode/DerivedData/tguiS-ghkdqmzdojvzrwghpznehbmsntcc/Build/Products/Debug/tguiS.app/Contents/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window. One of the two will be used. Which one is undefined.
objc[55496]: Class SFWindowController is implemented in both /Users/JME/Library/Frameworks/sfml-window.framework/Versions/2.2.0/sfml-window and /Users/JME/Library/Developer/Xcode/DerivedData/tguiS-ghkdqmzdojvzrwghpznehbmsntcc/Build/Products/Debug/tguiS.app/Contents/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window. One of the two will be used. Which one is undefined.
objc[55496]: Class SFViewController is implemented in both /Users/JME/Library/Frameworks/sfml-window.framework/Versions/2.2.0/sfml-window and /Users/JME/Library/Developer/Xcode/DerivedData/tguiS-ghkdqmzdojvzrwghpznehbmsntcc/Build/Products/Debug/tguiS.app/Contents/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window. One of the two will be used. Which one is undefined.

Also when I run, the window looks very weird and upon close it points to the class definition of "GuiContainer" in the file "Container.hpp" saying there was a "EXC_BAD_INSTRUCTION" and also prints the following error:

Quoteobjc[55709]: autorelease pool page 0x101a9f000 corrupted
  magic     0x00000000 0x00000000 0x00000000 0x00000000
  should be 0xa1a1a1a1 0x4f545541 0x454c4552 0x21455341
  pthread   0x0
  should be 0x7fff771c6300

(lldb)

Code for my main.cpp is:

Code (cpp) Select
#include <iostream>
#include <TGUI/TGUI.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

// Here is a small helper for you ! Have a look.
#include "ResourcePath.hpp"

int main(int, char const**)
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
    tgui::Gui gui(window);

    // Set the Icon
    sf::Image icon;
    if (!icon.loadFromFile(resourcePath() + "icon.png")) {
        return EXIT_FAILURE;
    }
    window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());

    // Create a graphical text to display
    sf::Font font;
    if (!font.loadFromFile(resourcePath() + "sansation.ttf")) {
        return EXIT_FAILURE;
    }
   
    gui.setGlobalFont("/Users/JME/Documents/Programming/tguiS/tguiS/sansation.ttf");
   
    sf::Text text("Hello SFML", font, 50);
    text.setColor(sf::Color::Black);
   
    tgui::Button::Ptr button(gui);
    button->load("/Users/JME/Documents/Programming/TGUI-0.6.7/widgets/Black.conf");
    button->setSize(100, 50);
    button->setPosition(400, 300);
    button->setText("Juicy");
    button->bindCallback(tgui::Button::LeftMouseClicked);
    button->setCallbackId(1);

    // 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();
            }

            // Espace pressed : exit
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                window.close();
            }
           
            gui.handleEvent(event);
        }

        tgui::Callback callback;
        while (gui.pollCallback(callback))
        {
            // Make sure tha callback comes from the button
            if (callback.id == 1)
            {
                std::cout << "Button clicked!\n";
            }
        }
       
        // Clear screen
        window.clear();
       
        window.draw(text);
        gui.draw();

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

texus

QuoteOne of the two will be used. Which one is undefined.
I recognise the error. I've seen it quite a lot last week while improving the mac support. It happens when the TGUI library was build against different SFML libraries than you use in your project.

Do you happen to have have sfml dylibs installed on your system (assuming that you are using sfml frameworks in your project)?

In cmake, you should check the "Advanced" checkbox and have a look at the entries like SFML_GRAPHICS_LIBRARY_RELEASE (so also the window and system ones). I suspect that the value of these entries are going to be different than the sfml libraries that you use in your project.