ncurses not working with iostream

Mar 18, 2014 at 9:30pm
ive recently started working with ncurses on linux. it doesnt want to compile if i include iostream in the headers. im not sure why that is so i havet been able to use any of the basis. i think it might be a problem with with my compile line. here an example of what i use co compile the file "ncursesv5" gcc -o ncursesv5 ncursesv5.cpp -lncurses what am i doing wrong?
Mar 18, 2014 at 9:35pm
a) you shouldnt be using ncurses with iostream. iostream cant reliably print to ncurses windows, which is why ncurses has its own printing streams

b) gcc is the command to compile using the gnu c compiler. gcc doesnt know how to compile (most) c++ code. instead you need to use the gnu c++ compiler (g++). so your command would be: g++ -o ncursesv5 ncursesv5.cpp -lncurses
Mar 19, 2014 at 3:39am
alright because i wanted to use fstream to output the text on my screen to a file. is that possible using ncurses without fstream?
Mar 19, 2014 at 6:38am
well iostream is very different than fstream (in this case). iostream is generally for printing to the console. you shouldnt need to use it with ncurses, because using it with a gui library (like ncurses or qt) is for logging data to the console (for debugging). since you cant see that data you would be logging with iostream when using ncurses, it is almost pointless. fstream just writes raw datatypes to a file. fstream is fine
Topic archived. No new replies allowed.