Thread: im a new coder. need compiler help!

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    8

    Unhappy im a new coder. need compiler help!

    when i compile the code shown below i get the following errors:

    warning w8065 bomber.c 20:call to function 'sound' with no prototype in function dropbomb

    warning w8065 bomber.c 21:call to function 'delay' with no prototype in function dropbomb

    warning w8065 bomber.c 23:call to function 'nosound' with no prototype in function dropbomb

    lnk errors:

    error:unresolved external '_sound' referenced from c:\bin\bomber.obj

    error:unresolved external '_delay' referenced from c:\bin\bomber.obj

    error:unresolved external '_nosound' referenced from c:\bin\bomber.obj

    the code i used:

    #include <stdio.h>
    #include <conio.h>
    #include <dos.h>

    void dropBomb(void);

    void main()
    {
    printf("press any key to drop bomb:");
    getch();
    dropBomb();
    printf("\nyikes!\n");
    }
    void dropBomb()
    {
    int x;

    for(x=880 ; x>440 ; x-=10)
    {
    sound(x);
    delay(100);
    }
    nosound();
    }


    what could be wrong?
    Last edited by slow; 12-08-2001 at 12:51 PM.

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    What compiler???
    1978 Silver Anniversary Corvette

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    EDIT: Nevermind, I didn't read that this is a compiler problem...
    Callou collei we'll code the way
    Of prime numbers and pings!

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    8

    Talking

    oops! im using the free borland 5.5 compiler.

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    8

    Unhappy

    please help!!!

  6. #6
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Okay, the compiler errors you are getting is pretty much saying, "hey, I can't find these functions in your code or the included head files. Fix it". I don't know what else to tell you.

    --Garfield
    1978 Silver Anniversary Corvette

  7. #7
    Registered User
    Join Date
    Nov 2001
    Posts
    8

    Angry

    "
    fix it
    if it were that easy there would be no reason for this forum.

  8. #8
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Sorry, I didn't mean it like that. I was just trying to light up the room with some humor of what the compiler is thinking

    Well, I told you what I think. Try looking up something with your linker. That could be the problem. I'm not sure though. Never had much experience fooling with compilers.
    1978 Silver Anniversary Corvette

  9. #9
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Drop Bomb Compile Problem

    Dear Slow

    I entered your code into the Borland Turbo C++ DOS compiler and compiled it without any errors. I ran the programme and pressed an S, got a long whiz sound. Nice !

    Next I loaded the code into MS C++ V6.0 Professional
    I tried to compile and got four warnings and zero errors
    c:\cprogrammes\slow.c(35) : warning C4013: 'sound' undefined; assuming extern returning int
    c:\cprogrammes\slow.c(36) : warning C4013: 'delay' undefined; assuming extern returning int
    c:\cprogrammes\slow.c(38) : warning C4013: 'nosound' undefined; assuming extern returning int
    Next I tried to execute but got four errors
    Linking...
    Slow.obj : error LNK2001: unresolved external symbol _nosound
    Slow.obj : error LNK2001: unresolved external symbol _delay
    Slow.obj : error LNK2001: unresolved external symbol _sound
    Debug/Slow.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    My interpretation is that the compiler (Yours and C++ 6.0) does not know or use: nosound; delay; and sound, functions. Perhaps it is a compiler problem after all.

    If it is not to checky I would like to know where I can get the free Borland 5.5 compiler from. I did look at there website but could not find it.

    Good luck

    Stephanos

  10. #10
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    That's a good observation, but it can't be. The functions are found in the headers. You can't take away a function already defined. If you are using the same headers, than I don't know what to tell you, two.
    1978 Silver Anniversary Corvette

  11. #11
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Drop Bomb compile Problem

    Dear Garfiled

    Thanks for your reply

    Please clarify the following: Do you mean that the three functions are known to be included the headers of the complier that Slow is using ?

    Also do you know where I can obtain a copy of the compiler Slow is using ?

    Stephanos

  12. #12
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    What I mean is that the linker is not recognizing the functions, therefore giving the errors.

    What compiler is slow using? I'm sure I can find a free download somewhere

    --Garfield
    1978 Silver Anniversary Corvette

  13. #13
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Compiler / Linker problem

    Dear Garfield and Slow

    I have a little more news

    I have downloaded the Borland command line compiler that was referred to and wrote the test programme the support material gave as an example. I compiled and ran the programme with no problems

    Next I went on to use the compiler to run C programmes I have written over a two year period for my course. Again no problems

    Next I tried Slow's programme. Alas, alack it did not compile giving the same error messages that Slow encountered.

    Next I opened C:\BORLAND\Bcc55\Include\dos.h in an editor to see if it had sound and delay listed as functions. They were not I also checked stdio.h and conio.h, but the three functions were not there either.

    Finaly, for completeness opened DOS.H, from my Borland C++ v 3 DOS IDE, into an editor and I did find delay and sound listed as functions and their suporting code.

    Unfortunately it would appear that these functions sound & delay are not supported by that version of compiler.

    Stephanos

  14. #14
    Registered User
    Join Date
    Nov 2001
    Posts
    8

    Thumbs up

    thanks for the replies stephanos and garfeild.

    i guess i better get another compiler.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  3. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  4. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  5. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM