Thread: Help with Arrays of Classes

  1. #1
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140

    Question Help with Arrays of Classes

    I am very very stuck. I looked at this code 100 times and I don't see anything wrong with it.

    The problem is, I cannot initialize a given element of a multi-dimensional array of classes.

    If anyone could download the .zip file and open the project file to checkout why it is giving me errors, I would be SOOOO HAPPY!

    The error is on line 153 of classes.cpp
    If you remove hte line, everything works perfectly.

    I use Dev-C++ to compile.


    Last edited by GrNxxDaY; 07-25-2002 at 03:41 AM.

  2. #2
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    I'll try .. hold on
    what does signature stand for?

  3. #3
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    What compiler did you use? Dev-C++ wont load it. I extract it in F:\temp and try and open it ... Says file not found C:\My Documents\whatever....
    What's The Problem?
    what does signature stand for?

  4. #4
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    *thinks hard*

    let me make a new zip file
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  5. #5
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Sure
    what does signature stand for?

  6. #6
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    try this.. it should unzip its own folder

    i am using dev-c++ 4
    Last edited by GrNxxDaY; 07-25-2002 at 03:59 AM.
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  7. #7
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Problems:
    C:/Windows/Desktop/helpGrNxxDay/classes.h is not found
    C:/Windows/Desktop/helpGrNxxDay/myheader.h is not found
    C:/Windows/Desktop/helpGrNxxDay/sourceCode.cpp is not found

    Dunno what's the prob
    what does signature stand for?

  8. #8
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    try unzipping it to that location.
    c:\windows\desktop\helpGrNxxDaY

    if that doesn't work.. i dunno?
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  9. #9
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Cant I'm using Windows2000 (NT) so I dont have access
    what does signature stand for?

  10. #10
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    dokie
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  11. #11
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    sorry
    what does signature stand for?

  12. #12
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    You cannot assign values to global variables, you can only initialise them. Or so it seems.

  13. #13
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Could be.. didnt check it out
    what does signature stand for?

  14. #14
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    It's working on my machine but I had to make some changes:

    B.t.w. Line 150 also gave me an error.

    [list=1][*]Replaced C:/DEV-C++/Bin/Mainicon.ico by a valid icon
    [*]Changed: Room roomArray[20][30];
    To: Room *roomArray[20][30];
    [*]Moved the last 2 lines to main (in sourceCode.cpp)
    Code:
    int main()
    {
       Room temp(3, 5, true, false, true, false, "A Dirt Trail", "Very dusty");
       roomArray[3][5] = &temp;
       ...
    }
    The last line is not working because you are not within the scope of a function. If you place it in a function (like main) it should work.[/list=1]

  15. #15
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    LOL
    what does signature stand for?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic allocation of 2 dim. arrays in classes
    By circuitbreaker in forum C++ Programming
    Replies: 4
    Last Post: 02-10-2008, 12:13 PM
  2. Help with arrays and pointers please...
    By crazyeyesz28 in forum C++ Programming
    Replies: 8
    Last Post: 03-17-2005, 01:48 PM
  3. Questions on Classes
    By Weng in forum C++ Programming
    Replies: 2
    Last Post: 11-18-2003, 06:49 AM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM