[eaf] Re: qt talán megmagyarázatlan linker error

  • From: "Istv�n Szennai" <darthasylum@xxxxxxxxxxx>
  • To: eaf@xxxxxxxxxxxxx
  • Date: Tue, 03 Apr 2007 19:05:52 +0000

Ööö egyáltalán miért static? :O Nekem ilyen szituban még sose volt rájuk szükségem. Csak akkor ha egy fv-t többször hivtam meg és nem akartam h változo kitörlödjön.



From: Zimler Attila Tamas <hijaszu@xxxxxxxxxxxx>
Reply-To: eaf@xxxxxxxxxxxxx
To: eaf@xxxxxxxxxxxxx
Subject: [eaf] Re: qt talán megmagyarázatlan linker error
Date: Tue, 03 Apr 2007 21:01:13 +0200

Ákos György Pfeff wrote:

Kedves szaktársaim!

Az idegbaj kerülget, mert már órák óta nem haladok szinte semmit, és kezd lejárni a szünetben az eaf-ra szánható idõm.

A problémám az, hogy nem értem miért nem fordul le a progim. Ilyen egyszerû. Írom a hibaüzenetet, és a kapcsolódó kódrészletet.

indexedbutton.o: In function `IndexedButton::setChoosenX(int)':
indexedbutton.cpp:(.text+0x48): undefined reference to `IndexedButton::_choosenX'
indexedbutton.o: In function `IndexedButton::setChoosenY(int)':
indexedbutton.cpp:(.text+0x58): undefined reference to `IndexedButton::_choosenY'
indexedbutton.o: In function `IndexedButton::getChoosenX()':
indexedbutton.cpp:(.text+0x62): undefined reference to `IndexedButton::_choosenX'
indexedbutton.o: In function `IndexedButton::getChoosenY()':
indexedbutton.cpp:(.text+0x72): undefined reference to `IndexedButton::_choosenY'
indexedbutton.o: In function `IndexedButton::setChoosen(bool)':
indexedbutton.cpp:(.text+0x88): undefined reference to `IndexedButton::_isChoosen'
indexedbutton.o: In function `IndexedButton::getChoosen()':
indexedbutton.cpp:(.text+0x94): undefined reference to `IndexedButton::_isChoosen' indexedbutton.o: In function `IndexedButton::IndexedButton(int, int, QWidget*)': indexedbutton.cpp:(.text+0x107): undefined reference to `IndexedButton::_isChoosen' indexedbutton.o: In function `IndexedButton::IndexedButton(int, int, QWidget*)': indexedbutton.cpp:(.text+0x197): undefined reference to `IndexedButton::_isChoosen'
indexedbutton.o: In function `IndexedButton::clickedSlot()':
indexedbutton.cpp:(.text+0x498): undefined reference to `IndexedButton::_isChoosen' indexedbutton.o:indexedbutton.cpp:(.text+0x4a7): more undefined references to `IndexedButton::_isChoosen' follow

...a kódrészlet pedig:

IndexedButton::IndexedButton(int x, int y, QWidget *parent)
    : QPushButton(parent), _x(x), _y(y), _isolated(false)
{
    connect(this,SIGNAL(clicked()),this,SLOT(clickedSlot()));
    _isChoosen = false;
}

void IndexedButton::setChoosenX(int x)
{ _choosenX = x; }

void IndexedButton::setChoosenY(int y)
{ _choosenY = y; }

int IndexedButton::getChoosenX()
{ return _choosenX; }

int IndexedButton::getChoosenY()
{ return _choosenY; }

void IndexedButton::setChoosen(bool l)
{ _isChoosen = l; }

bool IndexedButton::getChoosen()
{ return _isChoosen; }

void IndexedButton::clickedSlot()
{
    if(isBall() == false)
    {
        if(_isChoosen){ emit moveChoosenBall(_x,_y); }
    }
    else
    {
        if(!_isChoosen)
        {
            setBallChoosen();
            setChoosen(true);
            setChoosenX(_x);
            setChoosenY(_y);
        }
        else
        {
            emit moveChoose(_x,_y);
        }
    }
}

...ehhez pedig a header:

#ifndef INDEXEDBUTTON_H
#define INDEXEDBUTTON_H

#include <QtGui>

class IndexedButton : public QPushButton
{
    Q_OBJECT
   public:
    IndexedButton(int x, int y, QWidget *parent=0);
    int getX();
    int getY();
    bool isIsolated();
    void setIsolation(bool l);
    void setBallSmile();
    void setBallSad();
    void setBallChoosen();
    void putBall();
    void pickBall();
    bool isBall();
       static void setChoosenX(int x);
    static void setChoosenY(int y);
    static int getChoosenX();
    static int getChoosenY();
    static void setChoosen(bool l);
    static bool getChoosen();

private slots:
    void clickedSlot();

signals:
    void moveChoosenBall(int x, int y);
    void moveChoose(int x, int y);

private:
    static bool _isChoosen;
    static int _choosenX;
    static int _choosenY;
    int _x;
    int _y;
    bool _isolated;
};

#endif

Nagyon gyors segítségre lenne szükségem, amennyire ez lehetséges. Elõre is köszönet, és sok sikert mindenkinek!

--
Ákos

Szia,

Elso korben pl megprobalhatnad egyreszt az allomanyokat csatolni, masreszt vagy a .pro allomanyt is csatolni, vagy leirni, milyen paranccsal probaltad leforditani a kodot. (Ezen kivul az uzenet alapjan, esetleg ha a statikus valtozokat nem csak deklaralnad, hanem definialnad is, akkor lehet nem panaszkodna.)

Attila

--
Az eletben vannak szabalyok
Nehanyat meg lehet kerulni, a tobbit pedig meg lehet szegni
(The Matrix)

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: OpenKeyServer v1.2
Comment: Extracted from belgium.keyserver.net

mQGiBEE/HTYRBACInacMGc8B/lkX3CXh5D9wUDlmza4hoatNZjJmWNnPWC9c0h2V
Pi9zYJ1bVqeUnNDzCRpovPdwrswWvb9WpVOS0A7TafzWxCYud6gN8g5KiC7cSuJV
cxI0uv3jWSjUkLnECqTpm9piM4WptXrdFLxUyrKPu+Nl82QSjfdbB+8xXwCg+rWO
KeOZZGGGIYWu+rZ0M/MqyCUD/jqQVc7alF8+5y//zNDml3THTc3ljK8CLcHxFv6F
uADmvHSePRTR1ACBV3dTxL8awvanRsXC25LOuYgM1hF9RRwof59xNtXVttvo724b
FDR+oRDVKyoEm6Istfn9xbbNqRqPfk83SHvect/hlHsfgaTBKd+IRAEkbMIdRin/
E45fA/0bzklqLGj4a8qSxMMvZ1Ib+2RmH5I6o9o33FY3Nmc7IEXJizyTyQaASYCx
ldjuRmfWSOP3gQRrH5owuZq5KBCC/PNMNnUsA4noFmvIilA/9UYqMtQ0BNr+miIM
9/LV70ZbBHVpDLjb2baMjbKrmCFf9rjlc17fFsWk5ZJuE3/UxLQrWmltbGVyIEF0
dGlsYSBUYW3DoXMgPGhpamFzenVAaGxmc2xpbnV4Lmh1PohXBBMRAgAXBQJBPx02
BQsHCgMEAxUDAgMWAgECF4AACgkQ+3OFVYni0PSysACffD6VDtoer3aBe8Gpvn8e
gwiNNH8AmwcmBIrZeCOeobIuZZp3CCOgQblIuQENBEE/HTkQBACKNzv7gS0fgeiO
AMoss2bbO7X9GuO3ufc3+zx2yGV7SvYAuyWLOSMhs1ZYBVp6IawDY88zEx81oxRj
Jd4zO8h/3BI9cmjZ4NAmdv7lWjTs0I0ijFnemcFQaffxN8vIB9DqA4oyJ0A/bS7J
0E/i13sr7hRgB6NZbpy4PSSkczggvwADBQP8D3eakqeJHf1yLmw1XmQVDxHLxtrI
VL0TShFEfMGU/MLfKpcmrd43EsSondsNNm8jv4b9Y/Wgc8XPQQrfPodC5mKt8mQC
F/ovWBFs46YvhS5pojQmp6i9octTWw2OqVn3QgrBFqm4QvayLE9wRLm/xgaFApVI
4RiOOEA6SidURGCIRgQYEQIABgUCQT8dOQAKCRD7c4VVieLQ9HoZAJ4xR5Y1qlnC
LTn1GkbEW0Va+72EqwCfQTP37ylZGrvpYnFoewBIMuLFHM8=
=K0/l
-----END PGP PUBLIC KEY BLOCK-----



_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


Other related posts: