Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. :-1: error: symbol(s) not found for architecture x86_64 & :-1: error: collect2: ld returned 1 exit status
QtWS25 Last Chance

:-1: error: symbol(s) not found for architecture x86_64 & :-1: error: collect2: ld returned 1 exit status

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vietriceboy
    wrote on last edited by
    #1

    I'm learning QT and i have abplayer.h and abplayer.cpp files. standard C++ codes. can't build with the constructors and destructor in the cpp file. help? anyone? please? thanks!

    04:23:41: Running build steps for project CatTeV2...
    04:23:41: Configuration unchanged, skipping qmake step.
    04:23:41: Starting: "/usr/bin/make" -w
    make: Entering directory /Users/vietriceboy/SSE554Projects/CatTeV2-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug' g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o CatTeV2.app/Contents/MacOS/CatTeV2 main.o cattev2.o card.o hand.o AbPlayer.o moc_cattev2.o qrc_cards.o -F/Users/vietriceboy/QtSDK/Desktop/Qt/4.8.0/gcc/lib -L/Users/vietriceboy/QtSDK/Desktop/Qt/4.8.0/gcc/lib -framework QtGui -framework QtCore Undefined symbols for architecture x86_64: make: Leaving directory /Users/vietriceboy/SSE554Projects/CatTeV2-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Debug'
    "vtable for AbPlayer", referenced from:
    AbPlayer::AbPlayer(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in AbPlayer.o
    AbPlayer::AbPlayer(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in AbPlayer.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make: *** [CatTeV2.app/Contents/MacOS/CatTeV2] Error 1
    04:23:41: The process "/usr/bin/make" exited with code 2.
    Error while building project CatTeV2 (target: Desktop)
    When executing build step 'Make'

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Are you moc-ing AbPlayer.cpp? Is there a Q_OBJECT line in the AbPlayer class?

      Try rerunning qmake and then doing a clean build.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vietriceboy
        wrote on last edited by
        #3

        nope ... here is the header and cpp files. I hope this help and thanks again.

        #ifndef ABPLAYER_H
        #define ABPLAYER_H

        #include <iostream>
        #include <string>
        #include <vector>

        #include <QWidget>
        #include <QListView>
        #include"hand.h"

        class AbPlayer : public Hand
        {
        friend ostream& operator<<(ostream& os, const AbPlayer& aAbPlayer);

        public:
        AbPlayer(const string& s);
        QString makeLabelString();
        virtual void makePixmaps(AbPlayer& ) ;

        virtual ~AbPlayer();
        
        //indicates whether or not generic player wants to keep hitting
        virtual bool isHitting() const = 0;
        
        //returns whether generic player has busted - has a total greater than 21
        bool isBusted() const;
        
        //announces that the generic player busts
        QString bust() const;
        
        QString& getLabelQStr() const;
        string getName() const;
        

        protected:
        string name;
        Hand *hand;
        mutable QString labelQStr;
        };

        #endif // ABSTRACTPLAYER_H

        #include <iostream>
        #include <typeinfo>
        #include <string>
        #include <vector>
        #include <algorithm>
        #include <ctime>
        #include <sstream>
        #include <QMessageBox>

        #include"AbPlayer.h"
        using namespace std;
        class QLabel;
        class QString;

        AbPlayer::AbPlayer(const string &s): name(s)
        {

        }

        string AbPlayer::getName() const
        {
        return name;
        }

        QString& AbPlayer::getLabelQStr() const
        {
        return labelQStr;
        }

        bool AbPlayer::isBusted() const
        {
        return (getTotal() > 21);
        }

        QString AbPlayer::bust() const
        {
        string str = "";
        ostringstream oss ;
        oss << "";
        oss << name << " bust! ";
        str = oss.str();
        return str.c_str();
        }

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved