Thread: help me with this error

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    35

    help me with this error

    Hi all!
    Can somebody please tell me what the problem is with writing such a code?
    c is a double and v is a vector.

    Code:
    v.push_back(c%10);
    c=-c%10;
    both lines are incorrect. In the first line it draws a red line under "c" and in the second, under "-" giving the following error:
    expression must have integral or enum type.

    I have another question. somewhere in my program I have written:
    Code:
    b.num.erase(b.num.begin());
    where b is an object of a defined class and num, a vector. my intention is to erase the first element of this vector but I encounter an error saying: no instance of overloaded function...matches the argument list(the object has type qualifiers that prevents the match)
    and
    too few arguments in function call.
    what's wrong with that?

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Don't talk to us about red squiggly lines because of IntelliSense. Compile the code, then copy and paste the errors exactly as they appear.

    You can't use the modulus operator on a double.

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    35
    the errors are what I've written already, before or after compilation, which are the following:
    expression must have integral or enum type.
    no instance of overloaded function...matches the argument list(the object has type qualifiers that prevents the match)
    too few arguments in function call.
    I've already mentioned which occurs where.

    besides, I added this to my code:
    Code:
    static_cast<int>(c);
    it still says expression must have integral or enum type.

    the problem still exists. what do I do now?
    Last edited by Farnaz; 04-28-2011 at 09:37 AM.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by Farnaz View Post
    the errors are what I've written already, before or after compilation, which are the following:
    expression must have integral or enum type.
    no instance of overloaded function...matches the argument list(the object has type qualifiers that prevents the match)
    too few arguments in function call.
    I've already mentioned which occurs where.

    besides, I added this to my code:
    Code:
    static_cast<int>(c);
    it still says expression must have integral or enum type.

    the problem still exists. what do I do now?
    I am a C programmer and I know that adding an line of code like you posted does nothing to how the variable "c" is treated in any other line of code.

    Post the lines of code with the errors in them!!!!
    Post the lines of code that declare the variable used in the line with errors!!!
    Post the error message!!!
    Do the posting all in the same post!!!

    Tim S.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler error error C2065: '_beginthreadex; : undeclared identifier
    By Roaring_Tiger in forum Windows Programming
    Replies: 3
    Last Post: 04-29-2003, 01:54 AM
  2. Compiling error (Maybe a syntax error)
    By davidvoyage200 in forum C++ Programming
    Replies: 6
    Last Post: 03-27-2003, 10:09 PM
  3. extremely odd error, i mean maximum extremeness oddness error
    By Leeman_s in forum Windows Programming
    Replies: 3
    Last Post: 01-06-2003, 01:48 AM
  4. Compiler error or human error?
    By skyruler54 in forum C++ Programming
    Replies: 6
    Last Post: 09-06-2002, 02:27 PM
  5. fatal error C1001: INTERNAL COMPILER ERROR
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-21-2002, 12:07 PM