Code Help

This is a discussion on Code Help within the Game Programming forums, part of the General Programming Boards category; what is worng with this? //focus on sdl //fosdl1_1.cpp //16APR2002 //ernest pazera //requires static linkage to: //sdl.lib, sdlmain.lib //requires dynamic ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    Code Help

    what is worng with this?
    //focus on sdl

    //fosdl1_1.cpp
    //16APR2002
    //ernest pazera

    //requires static linkage to:
    //sdl.lib, sdlmain.lib

    //requires dynamic linkage to:
    //sdl.dll

    //include SDL stuff
    #include "sdl.h"

    //include ability to print to files
    #include <stdio.h>

    //main function
    int main(int argc, char* argv[])
    {
    //initialize SDL
    if (SDL_Init(SDL_INIT_VIDEO)==-1)
    {
    //error initializing SDL

    //report the error
    fprintf(stderr,"Could not initialize SDL!\n");
    }
    else
    {
    //SDL initialized

    //report success
    fprintf(stdout,"SDL initialized properly!\n");

    //quit SDL
    SDL_Quit();
    }

    //return 0
    return(0);
    }
    i get this error:
    Info :fosdl1_1.cpp: build due to .OBJ dependency D:\BC5\INCLUDE\SDL_version.h
    Info : fosdl1_1.cpp: cached age 2:51:13 PM 4/14/2002 file age <unknown>
    Info :Compiling C:\FO_SDL\EXAMPLES\FOSDL1_1\fosdl1_1.cpp
    Warn : fosdl1_1.cpp(43,2):Parameter 'argc' is never used
    Warn : fosdl1_1.cpp(43,2):Parameter 'argv' is never used
    Info :Linking C:\FO_SDL\EXAMPLES\FOSDL1_1\fosdl1_1.exe
    Error: Error: Unresolved external '_main' referenced from D:\BC5\LIB\C0X32.OBJ

  2. #2
    ! |-| /-\ +3 1337 Yawgmoth's Avatar
    Join Date
    Dec 2002
    Posts
    187

    Re: Code Help

    Originally posted by L_I_Programmer
    what is worng with this?
    The thing wrong with it is that you didn't use code tags.
    L33t sp3@k sux0rz (uZ it t@k3s 10 m1|\|ut3s 2 tr@nzl@te 1 \/\/0rd & th3n j00 h@\/3 2 g3t p@$t d@ m1zpelli|\|gz, @tr0(i0u$ gr@mm@r @|\|d 1n(0/\/\pr3#3|\|$1bl3 $l@|\|g. 1t p\/\/33nz j00!!

    Speling is my faverit sujekt

    I am a signature virus. Add me to your signature so that I may multiply.

  3. #3
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    at first glance it doesnt look like anything is wrong, but by seeing that error I could guess about a few things.

    One thing that could be wrong is either you are not linking to sdl.lib, sdlmain.lib and sdl.dll at all...or maybe just incorrectly.

    There is also another thing, however, that gets me a couple times. I dont know why this happens, but sometimes compilers like to be idiots, and they use old OBJ files. So delete the OBJ file that the compiler made when you compiled your code, forcing it to make a new one, and it might work. That has happened to me on several instances...I have no clue why.
    My Website

    "Circular logic is good because it is."

  4. #4
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    There is also another thing, however, that gets me a couple times. I dont know why this happens, but sometimes compilers like to be idiots, and they use old OBJ files. So delete the OBJ file that the compiler made when you compiled your code, forcing it to make a new one, and it might work. That has happened to me on several instances...I have no clue why.
    What compiler is that? I've never run into this issue but im interested as to what compiler, and maybe finding an answer as to why this happens.

  5. #5
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    Normally it happens to me when I use Borland C++ 5.02. I also use MSVC++ 6.0, but I'm not sure if it has ever done that to me when I use it.....it might have...it might not have...

    But it normally happens to me when I use BC++ 5.02
    My Website

    "Circular logic is good because it is."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21