LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-06-2007, 06:28 AM   #1
wood@addanc
Member
 
Registered: Sep 2004
Posts: 31

Rep: Reputation: 15
NCURSES library linking in C++


If I specify -lncurses I get the libncurses.so shared library which causes a segment fault when linked with my C++ application. If I specify -lncurses++ there isn't an equivalent libncurses++.so shared library on my openSuSE 10.2 distro. If I specify -static -lcurses++ to get the libncurses++.a static library (which does exists), but I find that one of the other libraries doesn't have a static version!

Is the omission of a libcurses.so shared library a distro problem?

Has anybody out there got a solution to this C++ linking problem?
 
Old 07-06-2007, 08:02 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Can you post a complete, compilable, tiny program which gives you the segmentation fault that you talked about?
 
Old 07-06-2007, 10:44 AM   #3
wood@addanc
Member
 
Registered: Sep 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Duff piece of wrapper code:

Code:
void Console::clear()
{
    clear();         // Intending to call ncurses clear() function. But just calls

    move(0, 0);
}

Code:
void Console::clear()
{
    ::clear();         // Intending to call ncurses clear() function.
    move(0, 0);
}
 
Old 07-06-2007, 10:48 AM   #4
wood@addanc
Member
 
Registered: Sep 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Duff piece of wrapper code:

Code:
void Console::clear()
{
    clear();         // Intending to call ncurses clear() function, but just calls
                     // Console::clear() recursively until segment fault.
    move(0, 0);
}
Better:

Code:
void Console::clear()
{
    ::clear();         // Now global namespace ncurses clear() function called.
    move(0, 0);
}
Better choice of names would have helped.
 
Old 07-07-2007, 08:26 AM   #5
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
To beat it to death, just so you're not left hanging:

Am I correct in assuming that you've solved your problem?
 
Old 07-08-2007, 10:03 AM   #6
wood@addanc
Member
 
Registered: Sep 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Yes

Cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
how to use ncurses library skie_knite007 Programming 1 03-01-2005 10:51 AM
gnome-terminal problem while trying to use ncurses library dreamhunter Linux - Newbie 2 09-29-2004 04:22 PM
gnome-terminal problem while trying to use ncurses library dreamhunter Programming 0 09-29-2004 04:48 AM
can't find library - Termcap or Ncurses Mynar Linux - Newbie 2 03-04-2004 08:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration