Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning errors on prototyping

Status
Not open for further replies.

filbert

Programmer
Oct 13, 2000
2
SG
I am studying &quot;C for dummies&quot;, in case anyone wants to know. The book says that I have to &quot;#include <dos.h>&quot; to use the functions &quot;sound()&quot;, &quot;nosound()&quot; and &quot;delay()&quot;. But even when I include it, I get three different warning errors:
Call to function 'sound' with no prototype in function main
Call to function 'delay' with no prototype in function main
Call to function 'nosound' with no prototype in function main

Can somebody please teach me how to solve this problem?


[sig][/sig]
 
Hi filbert,

you may need to specify the actual path for the include file using <header.h> the compiler will expect to find it in its lib directory. also being a c header you may need to use the &quot;path\header.h&quot; format.

PS don't worry about the title, there are good starting points ;-)

HTH
[sig]<p>Robert Dwyer<br><a href=mailto:rdwyer@orion-online.com.au>rdwyer@orion-online.com.au</a><br>[/sig]
 
The functions &quot;sound()&quot;, &quot;nosound()&quot; and &quot;delay()&quot; sound like they are compiler specific. Are you using the same C compiler that the &quot;Dummies Book&quot; examples are for??? [sig]<p> <br><a href=mailto:Kim_Christensen@telus.net>Kim_Christensen@telus.net</a><br><a href= Page</a><br> [/sig]
 
Hi filbert, Kim,

your quite right, my how we foreget!
i tried this using BC5, which has support and (after a long involved process, had to find a win 95 box to run it on)

this compiles as a dos program you may need to set your target to a &quot;dos standard&quot; the header excludes other targets!

#include <dos.h>

void main() {

delay(500);
sound(10000);

}

there is no hint of it in VC++ (didn't expect it!)
So as Kim said its compilier dependent, and platform dependent <it does nothing on NT4>. so what compiler package do you have??
[sig]<p>Robert Dwyer<br><a href=mailto:rdwyer@orion-online.com.au>rdwyer@orion-online.com.au</a><br>[/sig]
 
The compiler I am using is &quot;Borland C++ Compiler 5.5&quot; which I downloaded from My OS is &quot;Microsoft Windows 98&quot;. The source code I used is specifically for Borland compilers, so I really don't know what is wrong. Maybe it is the problem with my header file... [sig][/sig]
 
hi filbert,

get your favorite text editor and have a look at the dos.h file and check that it has any references to sound()& etc are included in that library header file, the other issue is it appears that you need to specify a &quot;DOS&quot; target for the exe. NOT an easywin or win16 win32 etc.

it would look something like

#if !defined(_Windows) || defined(__DPMI16__) || defined(__DPMI32__)
void _RTLENTRYF delay(unsigned __milliseconds);
void _RTLENTRY nosound(void);
void _RTLENTRY sound(unsigned __frequency);
#endif /* !_Windows || __DPMI16__ || __DPMI32__ */

note DO NOT change the header file in any way!

you might find that there are other &quot;Sound&quot; type packages for use with these OS targets, i'm not sure what is included in the BC5.5 package. check out online help or the imprise site.

HTH

[sig]<p>Robert Dwyer<br><a href=mailto:rdwyer@orion-online.com.au>rdwyer@orion-online.com.au</a><br>[/sig]
 
Hello,

The Borland C++ 5.5 compiler is Win32 only, and does not support DOS, and hence does not have the support you need to actually use it. You can download an older compiler (Turbo C++ 1.0) in the Borland Community Museum

HTH [sig]<p>Wouter Dijkslag<br><a href=mailto: > </a><br><a href= My site</a><br> [/sig]
 
C neophyte here.

Having the same problem - as filbert 3 years later. I'm using windows 2000, but also running the same borland 5.5 compiler I opened up the dos.h file, and I didn't any reference to anything called sound or nosound keywords.

So is the final resolution to this thread that the borland C++ 5.5 compliler won't work at all as suggested by Woody, or is it something about the include file itself, as suggested by RobertD

Ah say, there's somethin' a little &quot;eeeeeeee&quot; 'bout a boy who don't like basbawl...
 
for anyone else who may be searching the tek-tips database in the future on this topic.

I did as Wody (sorry, before I typed Woody by accident - bet that doesn't happen often) suggested. I downloaded and installed the old Turbo C++ version 1.01 from the Borland Museum - compiled the code there, and it seems to work.


Ah say, there's somethin' a little &quot;eeeeeeee&quot; 'bout a boy who don't like basbawl...
 
These old DOS functions were dropped in the newer Windows OS's and so most compilers also dropped them from their libraries. See


James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top