Thread: class/struct error ? :(

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    139

    class/struct error ? :(

    I am having problems putting a variable of a class inside a struct
    Item_Class (is my class)

    Code:
    struct player
    {
      int hp;
      Item_Class items;
    };
    that is my structure as soon as the "Item_Class" is put inside the struct it pulls up a string error, if I declare it outside of the struct it runs perfectly. Why is that?
    "The most common form of insanity is a combination of disordered passions and disordered intellect with gradations and variations almost infinite."

  2. #2
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    maybe the structs/classes clash so that they dont work together.
    Have you tried having them both as classes?

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I dunno, when I did it, it worked fine. Post your code.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    139
    okay the error now doesn't occur until I exit the program. here is the error message.

    Project project.exe raised exception class EAccessViolation with message 'Access violation at address 00401672. Read of address FFFFFF91'. Proccess stopped.

    It stops and then goes to the string_r.h line 194
    "The most common form of insanity is a combination of disordered passions and disordered intellect with gradations and variations almost infinite."

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    139
    but it doesn't occur if I don't have the class inside the structure
    "The most common form of insanity is a combination of disordered passions and disordered intellect with gradations and variations almost infinite."

  6. #6
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    >'Access violation at address 00401672. Read of address
    >FFFFFF91'

    Why the hell cant they have normal errors?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM