Skip to main content
gamedev.net
🔒 Locked

HELP Unknown Error

Started by drummerboy 1 reply 150+ views
Original Post
drummerboy
drummerboy
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
Dark Star
Dark Star
try importing header files for sound() and delay() I dont know what libraries they afre from but try including them

I think delay() function is from stdlib.h or stdio.h

so include those in ur code


Hope it helps


Dark Star
Uk
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
JuNC
JuNC
Is the project being saved correctly, with the correct compiler flags? It''s conceivable that the compiler sets up a particular library internally when you do project->new but doesn''t automatically add it to the project, so you just need to add the library (don''t know which it is so you''ll have to look it up).

quote:

Does the PC Speaker have a buffer that needs to cleared each time I start the program or something?



I seem to remember that the speaker is run off the Real Time Clock, which may well be being setup and not reset when the sound function is executed, what OS are you running under? It might well fail under windows.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.