C++/Terminal questions

Discussion in 'Mac Programming' started by toothyXdip, Apr 15, 2009.

  1. macrumors newbie

    Joined:
    Aug 27, 2008
    #1
    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.
     
  2. macrumors 6502

    Joined:
    Dec 6, 2006
  3. thread starter macrumors newbie

    Joined:
    Aug 27, 2008
    #3
    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:
     
  4. thread starter macrumors newbie

    Joined:
    Aug 27, 2008
    #4
    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:[​IMG]


    I still get the same
     
  5. macrumors 6502

    Joined:
    Apr 24, 2008
  6. thread starter macrumors newbie

    Joined:
    Aug 27, 2008
    #6
    Lol..thanks that worked...I should have tried that after installing it....
     
  7. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #7
    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
     

Share This Page