Results 1 to 3 of 3
  1. #1
    C++ compile error

    Member Since
    Apr 26, 2008
    C++ compile error

    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:

    **** 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:

    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.

    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?



  2. #2
    C++ compile error

    Member Since
    May 02, 2008
    your linker is not linking properly. tell your linker where to look, -L/WHERETOLOOK, then tell which lib it need, -l/LIBINEED

  3. #3
    C++ compile error

    Member Since
    Mar 15, 2007
    17" MacBook Pro, 2.33GHz C2D, 2GB RAM
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How do I compile source code on a mac Im trying to compile hydra 7.1.src.tar.gz on a
    By programmaster in forum OS X - Development and Darwin
    Replies: 5
    Last Post: 11-15-2011, 10:16 AM
  2. Why Can't I Compile With Terminal?
    By LEMike09 in forum OS X - Operating System
    Replies: 10
    Last Post: 09-29-2011, 01:09 AM
  3. could some one compile something for me
    By heavensent in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 07-06-2007, 03:55 AM
  4. UNIX C Compile Error
    By Zach_C in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 01-07-2004, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts