• C

call to undefined function error

How can I get this program to work?
And why didn't it work?

#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(void)
{
      int x;
      for(x=880;x>440;x-=10)
      {
            sound(x);
            delay(100);
      }
      nosound();
}

The error message I got was this. . .
call to undefined function 'sound'
call to undefined function 'delay'
call to undefined function 'nosound'

I am using borland C++ 5.2

Here's the definition in the help file about this error. . .
Your source file declared the current function to return some type other than void in C++ (or int in C), but the compiler encountered a return with no value. All int functions are exempt in C because in old versions of C, there was no void type to indicate functions that return nothing.

Don't understand on what to do???

rockmagickAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexVirochovskyCommented:
You code is OK. But test you setting:
sound/delay/.. it is DOS functions.
You must set DOS in you Target Windows.
For this goto View|Project , set mouse to you EXE , press right button and
chouse Target Expert from Popup Menu
and in Platform change to DOS.
Attention : it is only DOS! You can't
make, for example, Console Apps.
Alex
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cgallagherCommented:
Have you created a project?
If not then this may affect the function calls.

What you have to do is create a new project.
Set the platform to Dos standard (as called in bc4), and accept all the other default options.

From there you should edit your source file provided in the project, and add the exact same code andthen it should work.

If you have created a project then what AlexVirochovsky has said should be correct.
0
rockmagickAuthor Commented:
Thank you very much!!  Worked great!!  Now all I have to do is learn why.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.