Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: why can not use "sfSprite"  (Read 9947 times)

0 Members and 2 Guests are viewing this topic.

windhl

  • Newbie
  • *
  • Posts: 8
    • View Profile
why can not use "sfSprite"
« on: August 29, 2007, 08:48:50 am »
when I want to create a sfSprite instance like this:
Code: [Select]

.....
   //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);
......


the compile Error is
Quote

  variable 'vtable for sfSprite' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.


so  I want to know WHY?  and  what's "ld's" ?

Thank u  for your help ~~~

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
why can not use "sfSprite"
« Reply #1 on: August 29, 2007, 08:58:05 am »
It happens with MinGW and SFML dynamic libraries, I still don't know why. The only solution at the moment is to use static libraries instead.

ld is the name of the linker ;)
Laurent Gomila - SFML developer

windhl

  • Newbie
  • *
  • Posts: 8
    • View Profile
why can not use "sfSprite"
« Reply #2 on: August 29, 2007, 09:31:12 am »
thank u ~~~ I'll try again~~~ :roll:

windhl

  • Newbie
  • *
  • Posts: 8
    • View Profile
why can not use "sfSprite"
« Reply #3 on: August 29, 2007, 10:35:50 am »
I have tried some times

however  :(   it does not work with the static **.a or **-d.a

i use static libs in this order:
Quote

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


but there are too many errors like these:
Quote

  [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




and the compile info is:
Quote

 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




i will be crazy  for these ~~~~~ :?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
why can not use "sfSprite"
« Reply #4 on: August 29, 2007, 10:52:00 am »
Quote
i use static libs in this order:

Quote
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

Use the "-d" libraries in debug mode, and the others in release.
And also use the reverse order :
Quote
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-window.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-system.a

And for debug :
Quote
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-d.a
D:/windhl/SFML-1.0-sdk/SFML-1.0/lib/mingw/static/libsfml-system-d.a
Laurent Gomila - SFML developer

windhl

  • Newbie
  • *
  • Posts: 8
    • View Profile
why can not use "sfSprite"
« Reply #5 on: August 29, 2007, 10:58:41 am »
3k u~~~ :oops:

 

anything