Results 1 to 4 of 4

Thread: error in displaying "cannot bind std::basic_ostream<char>...

  1. #1
    Join Date
    Jan 2016
    Posts
    22
    Thanks
    13

    Default error in displaying "cannot bind std::basic_ostream<char>...

    Hello,
    i code with qt in console mode but i have an error in the method that should display the members of a simple class.
    the error is " erreur : cannot bind 'std::basic_ostream<char>' lvalue to 'std::basic_ostream<char>&&' cout << " type " << type; "
    here the .cpp
    Qt Code:
    1. #include "vehicule.h"
    2. #include <iostream>
    3. using namespace std;
    4.  
    5. Vehicule::Vehicule()
    6. {
    7. nbrPortes = 4;
    8. type = "Voiture";
    9. puissance = 5;
    10. }
    11. Vehicule::Vehicule(int portes, QString typeV, int puissanceV)
    12. :nbrPortes(portes), type(typeV), puissance(puissanceV)
    13. {}
    14. Vehicule Vehicule::operator+(Vehicule const &vehicule)
    15. {
    16. puissance = vehicule.puissance;
    17. type = type + " vehicle améilloré ";
    18. }
    19. void Vehicule::afficher() const
    20. {
    21. cout << "Voiture avec " << nbrPortes;
    22. cout << " type " << type;
    23. cout << " et avec une puissane de "
    24. << puissance << endl;
    25. }
    To copy to clipboard, switch view to plain text mode 
    .h
    Qt Code:
    1. #ifndef VEHICULE_H
    2. #define VEHICULE_H
    3. #include <QString>
    4.  
    5.  
    6. class Vehicule
    7. {
    8. public:
    9. Vehicule();
    10. Vehicule(int portes, QString typeV, int puissanceV);
    11. Vehicule operator+(Vehicule const &vehicule);
    12. void afficher() const;
    13.  
    14. protected:
    15. int nbrPortes;
    16. QString type;
    17. int puissance;
    18. };
    19.  
    20. #endif // VEHICULE_H
    To copy to clipboard, switch view to plain text mode 
    if some one can help me please. thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: error in displaying "cannot bind std::basic_ostream<char>...

    Qt Code:
    1. cout << qPrintable(type)
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    rafik (16th October 2016)

  4. #3
    Join Date
    Jan 2016
    Posts
    22
    Thanks
    13

    Default Re: error in displaying "cannot bind std::basic_ostream<char>...

    thank you a lot for this trick Mr anda .

  5. #4
    Join Date
    Oct 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: error in displaying "cannot bind std::basic_ostream<char>...

    Thanks for useful tip! I had the same issue, it's resolved now.
    MS SQL to PostgreSQL Migration
    http://www.convert-in.com/mss2pgs.htm

Similar Threads

  1. Replies: 3
    Last Post: 27th January 2013, 23:53
  2. QtXml can't properly resolve xml with char "&" in it
    By vertusd in forum Qt Programming
    Replies: 1
    Last Post: 1st June 2011, 10:26
  3. Replies: 1
    Last Post: 23rd August 2008, 22:09
  4. char arrays to "multiline editor"
    By baray98 in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2008, 06:19
  5. Problem in XML parsing ";" (semicolon) char
    By the_bis in forum Qt Programming
    Replies: 7
    Last Post: 1st June 2007, 11:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.