compiler warning - "mismatch in..."

This is a discussion on compiler warning - "mismatch in..." within the C++ Programming forums, part of the General Programming Boards category; Hi I've come across some compiler warnings and I have no idea what they mean. Also, these warning seem to ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    17

    compiler warning - "mismatch in..."

    Hi

    I've come across some compiler warnings and I have no idea what they mean. Also, these warning seem to only appear on my laptop, and not on the other computer.

    The warning says: "warning C4761: integral size mismatch in argument; conversion supplied".

    It occurs at a place in my code where I am outputting data of an object to a file using access methods: e.g.

    Code:
    file << object.getdata();
    Please could someone tell me what this warning means or point me to a source that will tell me, and why this warning only appears on one of my computers and not the other?

    Thank you in advance.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,668
    What type is "file" and what type does "getdata()" return?

    You have to post atleast enough code for us to compile in our heads.

    gg

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    17
    Oh sorry

    Writing to a text file in windows xp, and type of data is double.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,668
    Works fine for me...
    Code:
    #include <iostream>
    #include <fstream>
    using namespace std;
    
    class CObject
    {
        double m_d;
    public:
        void setdata(double d) {m_d = d;}
        double getdata() {return m_d;}
    };//CObject
    
    int main()
    {
        CObject object;
        object.setdata(2.3);
    
        ofstream file("test.txt");
        file << object.getdata();
        file.close();
    
        return 1;
    }//main
    You will have to post your code, I suspect that the warning has nothing to do with that line.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. compiler warning message
    By alice in forum C Programming
    Replies: 2
    Last Post: 04-18-2004, 12:53 PM
  4. bcc32 compiler warning when assigning null to pointer
    By finnepower in forum C++ Programming
    Replies: 4
    Last Post: 06-25-2002, 11:37 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21