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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to compile this file?

Status
Not open for further replies.

sedawk

Programmer
Feb 5, 2002
247
US
Hi,

I have a short file needs to compile with g++. After compilation it shows "segamentation fault". I think something wrong with my compiling options.

Here is the file:

#include <curses.h>

main()
{
int ret;
ret = beep();
}
// end file

Here is the compiler commmand line:
g++ -lncurses -o filename filename.c

After compilation, output &quot;segametation fault&quot;. What is wrong?

 
This is because you cannot call any of the function calls from Curses library before initializing.
Call initscr() before calling any of the Curses functions.

Hope this helps.

 
Thanks, it works now.

However, I couldn't control beeping frequencies and duration. How can I do that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top