Jacob99 Temat założony przez niniejszego użytkownika |
TGUI, a kompilator MinGW 4.7.1 » 2014-04-24 20:32:51 Chciałem napisać jakąś prostą gierkę w SFML 2.x . Nie chciałem pisać swojego GUI, więc poszukałem w internecie i znalazłem TGUI. Niestety, mój kompilator nie potraktował zbyt przyjaźnie tego GUI wywołując kilkadziesiąt błędów typu: D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr()': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:42:17: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: At global scope: D:\TGUI\include/TGUI/SharedWidgetPtr.inl:50:40: error: expected constructor, destructor, or type conversion before '(' token D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr(tgui::Gui&, const sf::String&)': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:60:17: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr(tgui::Container&, const sf::String&)': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:70:17: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In copy constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr(const tgui::SharedWidgetPtr<T>&)': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:81:27: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In constructor 'tgui::SharedWidgetPtr<T>::SharedWidgetPtr(const tgui::SharedWidgetPtr<U>&)': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:101:27: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'tgui::SharedWidgetPtr<U>& tgui::SharedWidgetPtr<T>::operator=(const tgui::SharedWidgetPtr<T>&)': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:132:31: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'tgui::SharedWidgetPtr<U>& tgui::SharedWidgetPtr<T>::operator=(const tgui::SharedWidgetPtr<U>&)': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:157:27: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'void tgui::SharedWidgetPtr<T>::reset()': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:192:28: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'bool tgui::SharedWidgetPtr<T>::operator!() const': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:212:31: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'T& tgui::SharedWidgetPtr<T>::operator*() const': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:254:9: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'T* tgui::SharedWidgetPtr<T>::operator->() const': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:263:9: error: 'nullptr' was not declared in this scope D:\TGUI\include/TGUI/SharedWidgetPtr.inl: In member function 'tgui::SharedWidgetPtr<U> tgui::SharedWidgetPtr<T>::clone() const': D:\TGUI\include/TGUI/SharedWidgetPtr.inl:288:28: error: 'nullptr' was not declared in this scope Nie rozumiem dlaczego mój kompilator nie uznaje zapisu "nullptr", skoro jest on w standardzie. Proszę czy mógłby ktoś pomóc? |
|
maly |
» 2014-04-24 20:35:29 Włącz C++11 -std=c++11 |
|
Jacob99 Temat założony przez niniejszego użytkownika |
» 2014-04-24 20:54:50 Gdzie włączyc C++ 11?
|
|
Jacob99 Temat założony przez niniejszego użytkownika |
» 2014-04-25 08:14:40 Dziękuję za podpowiedź. P.S. Aby włączyć standard C++11 trzeba wejść w Settings->Compiler->Global Compiler Settings->Compiler Flags i zaznaczyć flagę: have g++ follow the C++11 ISO C++ language standard [-std=c++11]
|
|
Jacob99 Temat założony przez niniejszego użytkownika |
» 2014-04-25 08:31:09 Niestety to nie załatwiło jeszcze sprawy, ponieważ teraz wyskakuje mi następujący błąd d:/code blocks/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -ltgui collect2.exe: error: ld returned 1 exit status W linkerze ustawiłem wszystko według tego tutorialu: TGUI, instalacja prekompilowanych bibliotek w Code::BlocksNie wiem dlaczego linker nie może tego znaleźć. |
|
hincu |
» 2014-04-25 10:19:21 przekompiluj liby ze zrodel : o |
|
texus |
» 2014-04-25 13:30:16 This means that CodeBlocks can't find the library. Are you sure you added the path containing the libtgui.a library in the Search directories of the Linker. |
|
Jacob99 Temat założony przez niniejszego użytkownika |
» 2014-04-26 10:40:18 Po rozwiązaniu problemów z linkerem nastał czas na błędy czasu wykonania ;) Po skompilowaniu i uruchomieniu poniższego kodu konsola wypisuje komunikaty, że nie można otworzyć pliku(zaznaczonego ramką): #include "SFML/Graphics.hpp" #include "TGUI/TGUI.hpp" #include <iostream> using namespace std; int main() { sf::RenderWindow okno( sf::VideoMode( 600, 500, 32 ), "GAME OF THE YEAR" ); sf::Texture ryc, ryc2; ryc.loadFromFile( "pociskl.bmp" ); ryc2.loadFromFile( "pociskr.bmp" ); sf::Sprite sprajt, sprajt2; sprajt.setTexture( ryc ); sprajt2.setTexture( ryc2 ); tgui::Gui gui; tgui::Button::Ptr button( gui ); --------------------------------------- | button->load( "D:/TGUI/widgets/Black" ); | --------------------------------------- button->setSize( 160, 60 ); button->setPosition( 100, 200 ); button->setText( "Fullscreen" ); bool b = true; while( okno.isOpen() || b == true ) { okno.clear( sf::Color::White ); sprajt.setPosition( 100, 200 ); sprajt2.setPosition( 500, 200 ); sprajt.setScale( 3, 3 ); sprajt2.setScale( 3, 3 ); sprajt.setOrigin( 5, 3 ); sprajt2.setOrigin( 5, 3 ); okno.draw( sprajt ); okno.draw( sprajt2 ); okno.display(); sf::Event event; sf::Vector2f pozycja = static_cast < sf::Vector2f >( sf::Mouse::getPosition( okno ) ); while( okno.pollEvent( event ) ) { if( event.type == sf::Event::Closed ) okno.close(); if( event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape ) okno.close(); if( event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left && pozycja == sprajt.getPosition() ) okno.create( sf::VideoMode( 600, 500, 32 ), "GAME OF THE YEAR" ); b = false; } } return 0; } Komunikat o błędzie: TGUI error: Failed to open D:/TGUI/widgets/Button/Black |
|
« 1 » 2 |