Thread: Errors Manifold

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    37

    Errors Manifold

    What do the following errors mean?
    1. variable-size type declared outside of any function
    2. no match for 'operator!=' in 'e[temp]!='\000''
    candidates are BOOL operator!=(const GUID&, const GUID&)

    First case, the error line is one where I declared an object-array with a variable as length, and I wanted the array to be global)

    Second case is - for(temp=0; e[temp]!='\0'; temp++)
    (temp is an global integer, e[] is a object-array.
    Thanks.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    "variable sized type" is when you have something like:
    Code:
    int size = 100;
    char array[size];
    The fix is to make "size" a const.

    What is "e[temp]"? Is it perhaps of type GUID, in which case, it appears, that you can't compare it with a char - you may need to create a "NUL-GUID" or some such to compare your GUID value with, perhaps.

    If this doesn't help, please post a section of the code you are having problems with.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    The larch
    Join Date
    May 2006
    Posts
    3,573
    1. Variable-size arrays are not standard in the first place (some compilers support them by extension because they exist in C99) and do not miraculously substitute dynamically allocated arrays.

    2. I suppose there is no GUID constuctor that can make a GUID instance out of a character.

    In addition limit the usage of global variables. There is no need to use a global variable for a loop counter (or a global variable called temp - a global variable is not temporary).
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  4. #4
    Registered User
    Join Date
    Sep 2007
    Posts
    37
    @matsp- A const is just what I dont want to make it
    @anon - "and do not miraculously substitute dynamically allocated arrays."
    That's nailed it, then.
    I dunno what's a GUID....e[] is just the same object array mentioned in case 1, and temp is just to calculate a position in it.
    Thanks.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ehm, "object array" is obviously not, say, a character array - and you are trying to compare with a character - which is why the compiler is complaining. And as far as I can tell, it looks like your class for the object is "GUID" - but perhaps thats just an artifact of something else that the compiler is utterly confused about.

    GUID in generally stands for "Globally Unique IDentifier", but there's other meanings too.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Sep 2007
    Posts
    37
    Omfg I went and confused it with a character array which has an '\0' in the end to help in comparison...Pwnd. I am using the dynamic memory allocation method now, which should've bin done ages back...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  2. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  3. Unknown Errors in simple program
    By neandrake in forum C++ Programming
    Replies: 16
    Last Post: 04-06-2004, 02:57 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM