Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

toothyXdip

macrumors newbie
Original poster
Aug 27, 2008
17
0
I'm making a little game in c++ (using terminal) and I have a few questions for doing some things.

1.) Is there a way where I can position something (like a variable) towards the bottom of the terminal and stay there?

2.) Is there a way where I can clear the terminal? Like have it ask a question then erase that question and ask another one.

3.) If I wear to have a perm. placed var, how could I update that var without calling it again. (Lets say you have a money variable equal to 10 and you subtract 5 from it and without doing anything the number automatically updates with the new value of 5.
 

toothyXdip

macrumors newbie
Original poster
Aug 27, 2008
17
0
I looked into it and thats what I need but i just need some help compiling it.
When i compile using gcc <filename> -lncurses I get this error:
Code:
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in ccbYsUJs.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
even if I just copy a example file from the web.
:confused:
 

toothyXdip

macrumors newbie
Original poster
Aug 27, 2008
17
0
Ok I installed ncurses by following this guide: http://ncurses.darwinports.com/

Now I am wondering what to do with a "Hello, world" example file using ncurses:
Code:
#include <ncurses.h>

int main()
{	
	initscr();			/* Start curses mode 		  */
	printw("Hello World !!!");	/* Print Hello World		  */
	refresh();			/* Print it on to the real screen */
	getch();			/* Wait for user input */
	endwin();			/* End curses mode		  */

	return 0;
}

I decided to start using xcode so if someone would tell me how to get this working I would be very appreciative.

When i try to compile using gcc <filename.cpp> -lncurses
I still get the error:
Code:
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in ccbYsUJs.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Image:
NCurses_TermError.jpg



I still get the same
 

ChrisA

macrumors G5
Jan 5, 2006
12,922
2,181
Redondo Beach, California
When i try to compile using gcc <filename.cpp> -lncurses
I still get the error:
Code:
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in ccbYsUJs.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Looks like you have the "-l" flage correct but you need a "-L" (upper case L) flage to point to the directory where the library is. Either that or set a library path

This is not a "Mac" thing. It's a compiler issue and it works the same on all unix-like OSes
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.