1
Graphics / why can not use "sfSprite"
« on: August 29, 2007, 10:58:41 am »
3k u~~~ :oops:
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.
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-system.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-system-d.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window-d.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics-d.a
[Linker error] undefined reference to `sfClock::GetElapsedTime() const'
[Linker error] undefined reference to `sfClock::Reset()'
...
more undefined references to `sfClock::Reset()' follow
[Linker error] undefined reference to `sfClock::sfClock()'
...
[Linker error] undefined reference to `glBegin@4'
...
[Linker error] undefined reference to `glTexImage2D@36'
...
ld returned 1 exit status
Default compiler
Building Makefile: "C:\Dev-Cpp\sfml\Makefile.win"
make...
make.exe -f "C:\Dev-Cpp\sfml\Makefile.win" all
g++.exe main.o -o "renderwin.exe" -L"C:/Dev-Cpp/lib" -mwindows D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-system.a D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-system-d.a D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window-d.a D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics-d.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x165):Window.cpp: undefined reference to `sfClock::GetElapsedTime() const'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x173):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x22d):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x26b):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x2ec):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x330):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x3e4):Window.cpp: more undefined references to `sfClock::Reset()' follow
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x1187):Window.cpp: undefined reference to `sfClock::sfClock()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x1265):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x19d7):Window.cpp: undefined reference to `sfClock::sfClock()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x1ab5):Window.cpp: undefined reference to `sfClock::Reset()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x2221):Window.cpp: undefined reference to `sfClock::sfClock()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x29a1):Window.cpp: undefined reference to `sfClock::sfClock()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x3121):Window.cpp: undefined reference to `sfClock::sfClock()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-window.a(Window.o)(.text+0x3871):Window.cpp: undefined reference to `sfClock::sfClock()'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x5ac):Sprite.cpp: undefined reference to `glBegin@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x5c6):Sprite.cpp: undefined reference to `glTexCoord2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x5d5):Sprite.cpp: undefined reference to `glVertex2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x5ea):Sprite.cpp: undefined reference to `glTexCoord2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x5f9):Sprite.cpp: undefined reference to `glVertex2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x60e):Sprite.cpp: undefined reference to `glTexCoord2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x620):Sprite.cpp: undefined reference to `glVertex2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x635):Sprite.cpp: undefined reference to `glTexCoord2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x647):Sprite.cpp: undefined reference to `glVertex2f@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Sprite.o)(.text+0x64f):Sprite.cpp: undefined reference to `glEnd@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x335):RenderWindow.cpp: undefined reference to `glPopAttrib@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x346):RenderWindow.cpp: undefined reference to `glMatrixMode@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x353):RenderWindow.cpp: undefined reference to `glPopMatrix@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x39c):RenderWindow.cpp: undefined reference to `glMatrixMode@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x3a9):RenderWindow.cpp: undefined reference to `glPushMatrix@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x3ba):RenderWindow.cpp: undefined reference to `glPushAttrib@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x4bd):RenderWindow.cpp: undefined reference to `glMatrixMode@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x4ca):RenderWindow.cpp: undefined reference to `glLoadIdentity@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x510):RenderWindow.cpp: undefined reference to `glOrtho@48'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x55d):RenderWindow.cpp: undefined reference to `glEnable@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x575):RenderWindow.cpp: undefined reference to `glAlphaFunc@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x589):RenderWindow.cpp: undefined reference to `glEnable@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x59d):RenderWindow.cpp: undefined reference to `glEnable@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x5b1):RenderWindow.cpp: undefined reference to `glDisable@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x5c5):RenderWindow.cpp: undefined reference to `glDisable@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x5d9):RenderWindow.cpp: undefined reference to `glDisable@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x5ed):RenderWindow.cpp: undefined reference to `glShadeModel@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x60a):RenderWindow.cpp: undefined reference to `glHint@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x61c):RenderWindow.cpp: undefined reference to `glClearDepth@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x630):RenderWindow.cpp: undefined reference to `glClearStencil@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0xc4c):RenderWindow.cpp: undefined reference to `glViewport@16'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0xd39):RenderWindow.cpp: undefined reference to `glClearColor@16'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0xd49):RenderWindow.cpp: undefined reference to `glClear@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0xed2):RenderWindow.cpp: undefined reference to `glReadPixels@28'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(RenderWindow.o)(.text+0x43):RenderWindow.cpp: undefined reference to `glGetError@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x22a):Drawable.cpp: undefined reference to `glMatrixMode@4'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x237):Drawable.cpp: undefined reference to `glLoadIdentity@0'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x251):Drawable.cpp: undefined reference to `glBlendFunc@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x287):Drawable.cpp: undefined reference to `glColor4ub@16'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x2ab):Drawable.cpp: undefined reference to `glTranslatef@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x2d0):Drawable.cpp: undefined reference to `glRotatef@16'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x2f9):Drawable.cpp: undefined reference to `glTranslatef@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Drawable.o)(.text+0x314):Drawable.cpp: undefined reference to `glScalef@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x395):Image.cpp: undefined reference to `glDeleteTextures@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x3dc):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x408):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x434):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x44e):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x48c):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x4b8):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x4e4):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x4fe):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x52e):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x681):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x6ce):Image.cpp: undefined reference to `glTexSubImage2D@36'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x6e8):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x898):Image.cpp: undefined reference to `glGenTextures@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x8b6):Image.cpp: undefined reference to `glBindTexture@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x90d):Image.cpp: undefined reference to `glTexImage2D@36'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x933):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x954):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x970):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x996):Image.cpp: undefined reference to `glTexParameteri@12'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x9e0):Image.cpp: undefined reference to `glDeleteTextures@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0xcbb):Image.cpp: undefined reference to `glDeleteTextures@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0xdc6):Image.cpp: undefined reference to `glDeleteTextures@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0xec6):Image.cpp: undefined reference to `glDeleteTextures@8'
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-graphics.a(Image.o)(.text+0x169d):Image.cpp: undefined reference to `glDeleteTextures@8'
collect2: ld returned 1 exit status
make.exe: *** [renderwin.exe] Error 1
.....
//1.create a Image in the memory
sfImage Image;
if(!Image.LoadFromFile("windhl.jpg"))
return EXIT_FAILURE;
//2.create a spirte
sfSprite Sprite;
Sprite.SetImage(Image);
......
variable 'vtable for sfSprite' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main rendering window
sfRenderWindow App(sfVideoMode(800, 600, 32), "SFML Graphics", false);
sfString Text("Hello SFML", "cheeseburger.ttf", 50);
bool Running = true;
while (Running)
{
// Process events
sfEvent Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sfEvent::Close)
Running = false;
}
App.Draw(Text);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
Unhandled exception at 0x7c812a5b in sfml1.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f45c.
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main rendering window
sfRenderWindow App(sfVideoMode(800, 600, 32), "SFML Graphics", false);
// Load the sprite image from a file
sfImage Image;
if (!Image.LoadFromFile("sprite.tga"))
return EXIT_FAILURE;
// Create the sprite
sfSprite Sprite(Image);
// Change its properties
Sprite.SetColor(sfColor(0, 255, 255, 128));
Sprite.SetLeft(200.f);
Sprite.SetTop(100.f);
Sprite.SetScale(2.f);
// Start game loop
bool Running = true;
while (Running)
{
// Process events
sfEvent Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sfEvent::Close)
Running = false;
}
// Get elapsed time
float ElapsedTime = App.GetFrameTime();
// Move the sprite
if (App.GetInput().IsKeyDown(sfKey::Left)) Sprite.SetLeft(Sprite.GetLeft() - 100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sfKey::Right)) Sprite.SetLeft(Sprite.GetLeft() + 100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sfKey::Up)) Sprite.SetTop(Sprite.GetTop() - 100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sfKey::Down)) Sprite.SetTop(Sprite.GetTop() + 100 * ElapsedTime);
// Rotate the sprite
if (App.GetInput().IsKeyDown(sfKey::Add)) Sprite.Rotate(- 100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sfKey::Subtract)) Sprite.Rotate(+ 100 * ElapsedTime);
// Display sprite in our window
App.Draw(Sprite);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
error LNK2001: unresolved external symbol "public: bool __thiscall sfInput::IsKeyDown(enum sfKey::Code)const " (?IsKeyDown@sfInput@@QBE_NW4Code@sfKey@@@Z)
error LNK2001: unresolved external symbol "private: virtual void __thiscall sfWindow::OnEvent(class sfEvent const &)" (?OnEvent@sfWindow@@EAEXABVsfEvent@@@Z)