Original Post
Hi,
Having an odd time compiling this little program in Borland C++ 5.01.
#include <stdio.h>
#include <dos.h>
#include <conio.h>
void soundtest(void); //prototype
void main(void)
{
printf("Press a key to begin.");
printf("\nPress a key to end");
getch();
soundtest();
}
void soundtest(void)
{
int s;
for(s=0;s<800;s++)
{
sound(s);
delay(100);
if(kbhit())
{
printf("\n\nExcellent!");
break;
}
}
}
It compiles fine, but if I turn off the computer and come back to it later or reset the computer and try to re-compile the program, I get the following error messages
Error: Unresolved external ''_sound'' referenced from module soundtest.c
Error: Unresolved external ''_delay'' referenced from module soundtest.c
I get this message even If I don''t tweak the program, just compiling it again as it is triggers the errors. So everytime I want to tweak it after starting up the comp again, I have to copy and paste the code into a new project file, then it works fine.
As well, when the program is working, the sound only works the first time the program is run, and subsequent tries result in not getting any sound (though the program does run, albeit silently) and I have to reboot the computer for it to work again. Does the PC Speaker have a buffer that needs to cleared each time I start the program or something?
Thank You