Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 15, 2009, 04:31 PM   #1
toothyXdip
macrumors newbie
 
Join Date: Aug 2008
C++/Terminal questions

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 is offline   0 Reply With Quote
Old Apr 15, 2009, 04:35 PM   #2
garethlewis2
macrumors 6502
 
Join Date: Dec 2006
You need the ncurses library.

Google it.
garethlewis2 is offline   0 Reply With Quote
Old Apr 15, 2009, 04:55 PM   #3
toothyXdip
Thread Starter
macrumors newbie
 
Join Date: Aug 2008
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.
toothyXdip is offline   0 Reply With Quote
Old Apr 15, 2009, 08:19 PM   #4
toothyXdip
Thread Starter
macrumors newbie
 
Join Date: Aug 2008
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:


I still get the same
toothyXdip is offline   0 Reply With Quote
Old Apr 16, 2009, 06:28 AM   #5
Sander
macrumors 6502
 
Join Date: Apr 2008
Try g++ instead of gcc.
Sander is offline   0 Reply With Quote
Old Apr 16, 2009, 12:45 PM   #6
toothyXdip
Thread Starter
macrumors newbie
 
Join Date: Aug 2008
Lol..thanks that worked...I should have tried that after installing it....
toothyXdip is offline   0 Reply With Quote
Old Apr 16, 2009, 01:01 PM   #7
ChrisA
macrumors G4
 
Join Date: Jan 2006
Location: Redondo Beach, California
Quote:
Originally Posted by toothyXdip View Post
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
ChrisA is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
3 Questions - Shabby Migration Manager Performance and Terminal? garycurtis OS X Mavericks (10.9) 2 May 14, 2014 01:42 PM
General: FIX "Error opening terminal: xterm-256color" for Terminal Commands (e.g., "top") iOS7 thelatinist Jailbreaks and iOS Hacks 9 Jan 10, 2014 07:46 PM
Terminal terminal-ology geohump Mac Applications and Mac App Store 0 May 17, 2013 12:40 PM
Terminal unix command questions savoym OS X 10.8 Mountain Lion 3 Sep 17, 2012 12:59 PM
Terminal Path questions dukebound85 Mac Applications and Mac App Store 2 Jun 7, 2012 04:23 PM

Forum Jump

All times are GMT -5. The time now is 02:46 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC