starter Temat założony przez niniejszego użytkownika |
[SFML 1.6] undefined reference to ... » 2012-11-19 12:05:11 Witam, pisze program i gdy próbuję go zbudować to wywala dziwne logi: c:/program files/codeblocks/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs. lib\libSystem.a(System.o):System.cpp:(.text+0x13): undefined reference to `sf::Window::GetInput() const' lib\libSystem.a(System.o):System.cpp:(.text+0x1d): undefined reference to `sf::Input::GetMouseY() const' lib\libSystem.a(System.o):System.cpp:(.text+0x27): undefined reference to `sf::Input::GetMouseX() const' lib\libSystem.a(System.o):System.cpp:(.text+0x3f): undefined reference to `sf::RenderWindow::ConvertCoords(unsigned int, unsigned int, sf::View const*) const' lib\libSystem.a(System.o):System.cpp:(.text+0x57): undefined reference to `sf::Drawable::TransformToLocal(sf::Vector2<float> const&) const' lib\libSystem.a(System.o):System.cpp:(.text+0x83): undefined reference to `sf::Sprite::GetSize() const' lib\libSystem.a(System.o):System.cpp:(.text+0xa2): undefined reference to `sf::Sprite::GetSize() const' lib\libSystem.a(System.o):System.cpp:(.text+0xe1): undefined reference to `sf::Drawable::SetPosition(sf::Vector2<float> const&)' lib\libSystem.a(System.o):System.cpp:(.text+0xf3): undefined reference to `sf::Drawable::SetPosition(sf::Vector2<float> const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x105): undefined reference to `sf::Drawable::SetPosition(sf::Vector2<float> const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x117): undefined reference to `sf::Drawable::SetPosition(sf::Vector2<float> const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x140): undefined reference to `sf::Drawable::SetPosition(float, float)' lib\libSystem.a(System.o):System.cpp:(.text+0x156): undefined reference to `sf::Drawable::SetPosition(float, float)' lib\libSystem.a(System.o):System.cpp:(.text+0x16c): undefined reference to `sf::Drawable::SetPosition(float, float)' lib\libSystem.a(System.o):System.cpp:(.text+0x182): undefined reference to `sf::Drawable::SetPosition(float, float)' lib\libSystem.a(System.o):System.cpp:(.text+0x1b4): undefined reference to `sf::Window::GetInput() const' lib\libSystem.a(System.o):System.cpp:(.text+0x1c4): undefined reference to `sf::Input::IsMouseButtonDown(sf::Mouse::Button) const' lib\libSystem.a(System.o):System.cpp:(.text+0x27c): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x292): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x2a8): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x2fe): undefined reference to `sf::Unicode::Text::Text(std::string const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x31f): undefined reference to `sf::String::SetText(sf::Unicode::Text const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x425): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x445): undefined reference to `sf::String::String()' lib\libSystem.a(System.o):System.cpp:(.text+0x466): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x487): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x4a6): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x4bd): undefined reference to `sf::Unicode::Text::Text(std::string const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x4d9): undefined reference to `sf::String::SetText(sf::Unicode::Text const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x596): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x5ad): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x670): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x68e): undefined reference to `sf::String::String()' lib\libSystem.a(System.o):System.cpp:(.text+0x6ab): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x6c4): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x78a): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x7a8): undefined reference to `sf::String::String()' lib\libSystem.a(System.o):System.cpp:(.text+0x7c5): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x7de): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x8a7): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x8c7): undefined reference to `sf::String::String()' lib\libSystem.a(System.o):System.cpp:(.text+0x8e8): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x909): undefined reference to `sf::Sprite::Sprite()' lib\libSystem.a(System.o):System.cpp:(.text+0x928): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x93f): undefined reference to `sf::Unicode::Text::Text(std::string const&)' lib\libSystem.a(System.o):System.cpp:(.text+0x95b): undefined reference to `sf::String::SetText(sf::Unicode::Text const&)' lib\libSystem.a(System.o):System.cpp:(.text+0xa18): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' lib\libSystem.a(System.o):System.cpp:(.text+0xa2f): undefined reference to `sf::Sprite::SetImage(sf::Image const&)' collect2: ld returned 1 exit status Info: resolving vtable for sf::Sprite by linking to __imp___ZTVN2sf6SpriteE (auto-import) Info: resolving vtable for sf::String by linking to __imp___ZTVN2sf6StringE (auto-import) Info: resolving sf::Color::Green by linking to __imp___ZN2sf5Color5GreenE (auto-import) Info: resolving sf::Color::Blue by linking to __imp___ZN2sf5Color4BlueE (auto-import) Info: resolving sf::Color::Red by linking to __imp___ZN2sf5Color3RedE (auto-import)
Używam Code::Blocks 10.05 |
|
wojownik266 |
» 2012-11-19 12:15:06 A czy w opcjach kompilatora masz wpisane np. -lsfml-window itp? |
|
starter Temat założony przez niniejszego użytkownika |
» 2012-11-19 12:20:53 Tak, ale to nic nie zmienia |
|
wojownik266 |
» 2012-11-19 12:33:07 Skoro tak to wydaje mi się że masz źle podane ścieżki do biblioteki SFML. Mam na myśli ścieżkę do libów i nagłówków. Ja mam tak: D\Program Files\CodeBlocks\SFML-2.0-rc\include Sprawdź swoje scieżki. I jescze jedno czy na pewno masz biblioteke SFML skompilowaną pod Code Blocka? Tak pytam gdyby ścieżki nie pomogły... |
|
starter Temat założony przez niniejszego użytkownika |
» 2012-11-19 12:36:32 Tak... kilka dni temu pisałem program i działał. Też z SFML. //edit: tak w ogóle to System.a to nie jest biblioteka SFML tylko moja. Czy to coś zmienia? |
|
wojownik266 |
» 2012-11-19 12:49:32 No nie wiem... Wklej kod tego programu co piszesz spróbuje go uruchomić na swoim kompie.. |
|
starter Temat założony przez niniejszego użytkownika |
» 2012-11-19 12:59:50 Mam jeden projekt z kilkoma build target'ami. Na razie mam tylko pierwszą część i chciałem ją przetestować, więc dodałem jeszcze jeden build target. System.hpp#include <SFML/Graphics.hpp> #include <string>
#ifndef SYSTEM_HPP #define SYSTEM_HPP
namespace mg { enum Btn { OK = 1, Cancel = 2, Info = 4, Properties = 8, Options = 16, Exit = 32, Instruction = 64, Browse = 128 }; enum Msg { MOK, MCancel, MInfo, MProperties, MOptions, MExit, MInstruction, MClose, MBrowse }; class Button { private: sf::Sprite button; sf::String text; sf::Sprite ticked; sf::Sprite pressed; public: Button(); Button( sf::Image nr1, std::string txt, sf::Image nr2, sf::Image nr3 ); void SetImages( sf::Image nr1, sf::Image nr2, sf::Image nr3 ); void SetText( std::string txt ); void Draw( sf::RenderWindow & window ); void SetPosition( float x, float y ); void SetPosition( sf::Vector2f coor ); bool IsTicked( sf::RenderWindow & window ); }; }
#endif
System.cpp#include "../include/System.hpp" #include <SFML/Graphics.hpp> #include <string>
namespace mg { Button::Button() { } Button::Button( sf::Image nr1, std::string txt, sf::Image nr2, sf::Image nr3 ) { button.SetImage( nr1 ); text.SetText( txt ); ticked.SetImage( nr2 ); pressed.SetImage( nr3 ); } void Button::SetImages( sf::Image nr1, sf::Image nr2, sf::Image nr3 ) { button.SetImage( nr1 ); ticked.SetImage( nr2 ); pressed.SetImage( nr3 ); } void Button::SetText( std::string txt ) { text.SetText( txt ); } void Button::Draw( sf::RenderWindow & window ) { if( IsTicked( window ) ) { if( window.GetInput().IsMouseButtonDown( sf::Mouse::Left ) ) { window.Draw( pressed ); window.Draw( text ); } else { window.Draw( ticked ); window.Draw( text ); } } else { window.Draw( button ); window.Draw( text ); } } void Button::SetPosition( float x, float y ) { button.SetPosition( x, y ); ticked.SetPosition( x, y ); pressed.SetPosition( x, y ); text.SetPosition( x, y ); } void Button::SetPosition( sf::Vector2f coor ) { button.SetPosition( coor ); ticked.SetPosition( coor ); pressed.SetPosition( coor ); text.SetPosition( coor ); } bool Button::IsTicked( sf::RenderWindow & window ) { const sf::Input & sterowanie = window.GetInput(); sf::Vector2f mysz = window.ConvertCoords( sterowanie.GetMouseX(), sterowanie.GetMouseY() ); sf::Vector2f punkt = button.TransformToLocal( mysz ); return( punkt.x >= 0 && punkt.y >= 0 && punkt.x <= button.GetSize().x && punkt.y <= button.GetSize().y ); } }
Test.cpp#include "include/System.hpp" #include <SFML/Graphics.hpp>
int main() { mg::Button key; sf::Image nr1, nr2, nr3; nr1.Create( 80, 25, sf::Color::Green ); nr2.Create( 80, 25, sf::Color::Blue ); nr3.Create( 80, 25, sf::Color::Red ); key.SetImages( nr1, nr2, nr3 ); key.SetText( "Test" ); key.SetPosition( 512, 300 ); sf::RenderWindow app( sf::VideoMode( 1024, 600, 32 ), "Test" ); while( app.IsOpened() ) { sf::Event zdarzenie; while( app.GetEvent( zdarzenie ) ) { if( zdarzenie.Type == sf::Event::Closed ) app.Close(); if( zdarzenie.Type == sf::Event::KeyPressed && zdarzenie.Key.Code == sf::Key::Escape ) app.Close(); } app.Clear( sf::Color( 255, 255, 255 ) ); key.Draw( app ); app.Display(); } return 0; }
Nie wiem czy to coś pomoże, ale dzięki za pomoc :) System.cpp - biblioteka Test.cpp - console app/GUI app |
|
wojownik266 |
» 2012-11-19 13:20:16 Wszystko kompiluje się bezbłędnie.. |
|
« 1 » 2 |