You are not logged in.
Hi all,
I'm sort of double threading but this is something slightly less general than my last thread; I've been trying to write a simple C++ console based application that uses the ncurses menus library; There's an excellent tutorial on using ncurses menus over here, but the example code only compiles as C code not as C++ code. (most of the example code will compile as C++ code, this particular example, however does not).
g++ complains:
"calloc" was not declared in this scrope.
g++ also wares me about depracated conversions from string constants to "char*".
I have some idea of why I get those errors/warning, but I don't know how to rewrite the code to get rid of the errors. The possibility exists, I suppose, that while libncurses++ supports C++ calls into ncurses that the menus library does not. Basically, I just want to know if there's already existing libraries that do what I want to do, that are documented somewhere, or if I should use a different method (i.e. use dialog and bash or ksh instead of ncurses/C++).
I'm sorry if I'm in some way being an idiot. If I am being an idiot, please make pointed suggestions.
Thanks!
Offline
For calloc, #include <cstdlib>, and either qualify it with std::, or put "using namespace std" somewhere. Do avoid the string conversion warnings, always use "const char *" to refer to literal string constants. In terms of the more general questions, I'd definitely use a real language (i.e. not bash) if you're doing anything serious. I would try to just use ncurses directly, unless libncurses++ has a very good interface.
Offline