Any help in solving the fix to this problem would be greatly appreacated.-----
Linking…
main.obj : error LNK2001: unresolved external symbol “void __cdecl
DrawPixel(struct SDL_Surface *,int,int,unsigned char,unsigned char,unsigned
char)” (?DrawPixel@@YAXPAUSDL_Surface@@HHEEE at Z)
Debug/SDL Tests.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
SDL Tests.exe - 2 error(s), 0 warning(s)
Source Code:
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
// The functions are not shown to save space
void DrawPixel(SDL_Surface *screen, int x, int y,
Uint8 R, Uint8 G, Uint8 B);
void Slock(SDL_Surface *screen);
void Sulock(SDL_Surface *screen);
void Slock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
if ( SDL_LockSurface(screen) < 0 )
{
return;
}
}
}
void Sulock(SDL_Surface *screen)
{
if ( SDL_MUSTLOCK(screen) )
{
SDL_UnlockSurface(screen);
}
}
int main(int argc, char *argv[])
{
if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 )
{
printf(“Unable to init SDL: %s\n”, SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
SDL_Surface *screen;
screen=SDL_SetVideoMode(640,480,32,SDL_HWSURFACE|SDL_DOUBLEBUF);
if ( screen == NULL )
{
printf(“Unable to set 640x480 video: %s\n”, SDL_GetError());
exit(1);
}
// DRAWING GOES HERE
Slock(screen);
for(int x=0;x<640;x++)
{
for(int y=0;y<480;y++)
{
DrawPixel(screen, x,y,y/2,y/2,x/3);
}
}
Sulock(screen);
SDL_Flip(screen);
return 0;
}
Jeffrey D. Means
CIO For MeansPC
@Jeff_Means