New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

C++ compile error


Post Reply New Thread Subscribe

 
Thread Tools
jimz

 
Member Since: Apr 26, 2008
Posts: 4
jimz is on a distinguished road

jimz is offline
Hi,

I'm having trouble with an example from a C++ book.

Using eclipse 3.32 on OS X 10.4.11, gcc version 4.0.1, I get this error message:

Code:
**** Build of configuration Debug for project ticTacToe ****

make all 
Building file: ../src/ticTacToe.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/ticTacToe.d" -MT"src/ticTacToe.d" -o"src/ticTacToe.o" "../src/ticTacToe.cpp"
Finished building: ../src/ticTacToe.cpp
 
Building target: ticTacToe
Invoking: MacOS X C++ Linker
g++  -o "ticTacToe"  ./src/ticTacToe.o   
/usr/bin/ld: Undefined symbols:
displayBoard(std::vector<char, std::allocator<char> > const&)
collect2: ld returned 1 exit status
make: *** [ticTacToe] Error 1
I then tried to compile it in Xcode 2.2.1, and it compiles but then crashes soon after running with this error message:

Code:
ZeroLink: unknown symbol '__Z12displayBoardRKSt6vectorIcSaIcEE'

tictactoe has exited due to signal 6 (SIGABRT).
If I comment out this function and all calls to the function, I don't get any errors and it compiles and runs.

Code:
void dipslayBoard(const vector<char>& board)
{
	cout << "\n\t" << board[0] << " | " << board[1] << " | " << board[2];
	cout << "\n\t" << "--------";
	cout << "\n\t" << board[3] << " | " << board[4] << " | " << board[5];
	cout << "\n\t" << "--------";
	cout << "\n\t" << board[6] << " | " << board[7] << " | " << board[8];
	cout << "\n\n";
}
Any ideas?

Thanks,

Jim.
QUOTE Thanks
KingMike

 
Member Since: May 02, 2008
Posts: 3
KingMike is on a distinguished road

KingMike is offline
your linker is not linking properly. tell your linker where to look, -L/WHERETOLOOK, then tell which lib it need, -l/LIBINEED
QUOTE Thanks
mystic_fm

 
Member Since: Mar 15, 2007
Posts: 161
mystic_fm will become famous soon enough
Mac Specs: 17" MacBook Pro, 2.33GHz C2D, 2GB RAM

mystic_fm is offline
If you copied the code into your message above verbatim from your source file, note that the function name is dipslayBoard() (including the typo of the reversed 'p' and 's'). If your calls to the function are expecting the name to be displayBoard(), as the linker error suggests, that would explain why the function appears to be missing at link time, and correcting the function's name should resolve the issue.
QUOTE Thanks

Post Reply New Thread Subscribe


« Carbon fwk - Filtering Files in open dialog | How to call dlopen for dll placed in /Application/Adobe Indesign CS3/Plugin folder »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Disk I/O error - General Hard Disk Slow Downs and Issues.. sunk976 Apple Notebooks 11 07-01-2009 01:51 AM
Crash on boot - CIFSPlugin: LdapKerbDomainInit failed with error x0x0 OS X - Operating System 5 07-31-2007 08:00 PM
rdesktop help tomaprik OS X - Apps and Games 0 01-29-2007 01:08 AM
UNIX C Compile Error Zach_C OS X - Development and Darwin 3 01-07-2004 01:43 PM
Upgrading PERL Forum Setup, MySQL, etc. ssotti OS X - Development and Darwin 0 11-29-2003 11:16 AM

All times are GMT -4. The time now is 10:47 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?