   Dev-C++ and SDL
#include <cstdio>#include <cstdlib>#include <iostream>#include <SDL/SDL.h>// The functions are not shown to save spacevoid DrawPixel(SDL_Surface *screen, int x, int y,Uint8 R, Uint8 G, Uint8 B);void Slock(SDL_Surface *screen);void Sulock(SDL_Surface *screen);SDL_Surface *screen;int main(int argc, char *argv[]){  if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 )  {    std::cout << "Unable to init SDL: " << SDL_GetError() << std::endl;    exit(1);  }  atexit(SDL_Quit);  screen=SDL_SetVideoMode(640,480,32,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN);  if ( screen == NULL )  {    std::cout << "Unable to set 640x480 video: " << SDL_GetError() << std::endl;    exit(1);  }  ///////////////////////// ///////////////////////// This is the erroring section... //BEGIN DRAWING////////// ///////////////////////// /////////////////////////   Slock(screen);for(int x=0;x<640;x++){  for(int y=0;y<480;y++)  {  DrawPixel(screen, x,y,256,0,0);  }}Sulock(screen);SDL_Flip(screen);//////////////////////////////////////////////END DRAWING/////////////////////////////////////////////////////  return 0; }Dev-CPP and Cone3D examplesI get: g++.exe ../../../Templates/main.o SDL_Test_private.res -o "SDL Test.exe" -L"C:/DEV-CPP/lib" -L"C:/Dev-Cpp/lib" -mwindows -lmingw32 -lSDLmain -lSDL -liberty ../../../Templates/main.o(.text+0x11c):main.cpp: undefined reference to `Slock(SDL_Surface*)'../../../Templates/main.o(.text+0x15d):main.cpp: undefined reference to `DrawPixel(SDL_Surface*, int, int, unsigned char, unsigned char, unsigned char)'../../../Templates/main.o(.text+0x17c):main.cpp: undefined reference to `Sulock(SDL_Surface*)'Execution terminated  When I try to compile... Yes I am including the SDL libs and all... it was working until I added my drawing routine... help.[edited by - Maxd Gaming on February 7, 2004 11:41:39 PM]
  It doesn''t look like an SDL problem. Where are your DrawPixel, Slock and Sulock functions defined? They are apparently not being linked with the project.   GolemBlender--The Gimp--Python--Lua--SDLNethack--Crawl--ADOM--Angband--Dungeondweller;quote:Original post by VertexNormal  It doesn''t look like an SDL problem. Where are your DrawPixel, Slock and Sulock functions defined? They are apparently not being linked with the project.   GolemBlender--The Gimp--Python--Lua--SDLNethack--Crawl--ADOM--Angband--Dungeondweller Umm... I thought they were defined in a SDL file... arent they?  It''s Maxd Gaming, put in an underscore and I will beat you with a rubber ducky! { My Site! - Banner } { My Site! - One time popup }{ My .Net Information  }{ A upcoming space RTS codenamed Gruntacktica . }{ . }Not following the new trend:Looky here mommy! No cow pic!   Phoe''s Forums   ;quote:Umm... I thought they were defined in a SDL file... arent they?No.  A quick check of the SDL documentation would have told you that.  Another clue that those functions were not part of SDL was that they have prototypes.  Libraries normally place function prototypes in .h files:  they would not need to appear in the client application.Anyways, you can find the definitions to those files at http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut1PS.  The Cone3D guy lifted those examples directly from examples in the documentation.;  BTW.. SDL uses a nameing convention of return type SDL_function_name(argument list)all SDL functions are proceeded with SDL_...so if you don''t see it, then it wasn''t originally issued with SDL... ;  Also, not to be too picky, but...DrawPixel() as specified takes three Uint8 (unsigned char) color components. In your code, you call with DrawPixel(screen, x,y,256,0,0);. That 256 is probably going to give you wierdness; it should be 255 (MAX(unsigned char)). Just thought you might like to know...  GolemBlender--The Gimp--Python--Lua--SDLNethack--Crawl--ADOM--Angband--Dungeondweller