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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Noob question, how to start terminal from a custom key Weemen Mac Basics and Help 2 Nov 9, 2010 02:25 AM
geek tool // terminal question Heart Break Kid Mac Applications and Mac App Store 4 Apr 19, 2004 09:05 PM
Terminal Question npm General Mac Discussion 2 Sep 26, 2002 11:25 AM
Terminal Question npm General Mac Discussion 0 Sep 26, 2002 01:26 AM
Terminal Question icetraxxg5 Mac Help/Tips 1 Jun 7, 2002 05:04 PM


All times are GMT -5. The time now is 07:56 AM.

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

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