2009-11-24 4 views
1

Product.cpp: 34: предупреждение: адрес из 'QTextStream & ENDL (QTextStream &)', всегда будет оценивать, как 'истинный'Что означает это предупреждающее сообщение?

Product.cpp: В функции члена Пустота продукта: : setProductToSold() ':

Product.cpp: 45: предупреждение: адрес из 'QTextStream & ENDL (QTextStream &)', всегда будет оценивать, как 'истинный'

#include <string> 
#include <iostream> 
#include <time.h> 
using std::string; 
using std::cout; 

#include "Product.h" 

Product::Product() 
{ 
    seller = ""; 
    itemName = ""; 
    price = 0.00; 
    min = 0.00; 
    buyingPrice = 0.00; 
    time = 0; 
    description = ""; 
    highestBidder = "None"; 
    currentBid = 0.00; 

    timer = new QTimer(this); 
    connect(timer, SIGNAL(timeout()), this, SLOT(setProductToSold())); 
} 

void Product::startTimer() 
{ 
Line 34: cout << " Timer Started " << endl; 
    timer->start(2000, TRUE); // 2 seconds single-shot timer 
} 

void Product::setHandler(Handler *h) 
{ 
    handler = h; 
} 

void Product::setProductToSold() 
{ 
Line 45: cout << " Item auction over" << endl; 
} 

Мои Product.h ::

#include <string> 

#include <qobject.h> 
#include <qtimer.h> 
#include <qgl.h> 

#include "HandleTCPClient.h" 

class Handler; 

//Define ourselves a product class 
class Product : public QObject 
    { 

     Q_OBJECT 


    public: 
     Product(); 

     QTimer *timer; 
     string seller, itemName, description, highestBidder; 
     double price, min, buyingPrice, currentBid; 
     int time; 
     bool isSold; 
     Handler *handler; 

     void setHandler(Handler *h); 
     void startTimer(); 

    public slots: 
     void setProductToSold(); 

    }; 

#endif 

Спасибо :)

+0

Что находится над линией 45? –

ответ

7

Вы (или Qt) переопределение Endl? попробуйте положить std :: endl

+1

Или поместите 'using std :: endl;' рядом с другими объявлениями 'using'. – Bill

0

Попробуйте использовать скрытие данных, члены класса должны находиться в частной части класса.
Почему #include "HandleTCPClient.h" в файле заголовка?

Смежные вопросы