Thread: MSVC++ help

  1. #1
    hacker in training AdamLAN's Avatar
    Join Date
    Sep 2004
    Posts
    56

    MSVC++ help

    I have two (2) questions for any C++ gurus out there:
    first, I have just gotten Microsoft Visual C++.net 2003, and can't install it. I'll run CD1, and then click "Prerequisites" to install the prerequisites, and it'll say "Setup has detected another program requires the system to reboot. Setup must be launched again after the system reboots" or something like that. Then it'll restart, of course, and then I have to start all over again. In a never ending cycle! I've tried contacting Microsoft but haven't gotten any response, so if anyone is familiar with MSVC++.net 2003, please help me!!!

    Also, I was wondering if arrays could work as pointers to structs. Like :

    struct test
    {
    int a;
    int b;
    int c;
    }
    int *array[5];
    for (int i=o, i<5, i++)
    {
    test new_test;
    array[i]=&new_test;
    }







    It would make a convient data structure.......


    I'm thankful for any help!

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    For your second question, there are two problems with your example. First, you probably want to use test* array[5] rather than int. Second, anything you declare inside the for loop will go out of scope when the loop completes, so the references will be invalid after the loop.

    Maybe you want to use the new operator instead:
    Code:
    test *array[5];
    for (int i=0, i<5, i++)
    {
    array[i]=new test;
    }
    //...
    array[0]->a=10;//or whatever you want to do with it
    //cleanup when done
    for (int i=0;i<5;i++)
    {
    delete array[i];
    }
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    That is an unusual problem that you are having with the installation... though I have seen similar things happen with MS software in the past. It sounds like something is amiss with the registry. Do a registry scan and repair all errors using a quality registry checker. There is a free one available from MS but I'm not sure just how good it is. The important thing is to keep running it until you get a clean scan. If you continue to have the problem you may want to try installing the prequisites manually so as to satisfy part one of the install and move on to part two.

    Yes you can have an array of pointers to anything you can have a pointer to... array of pointers to structures, array of pointers to functions, etc... but you must get the declaration syntax correct or it will not happen.
    Last edited by Rog; 10-24-2004 at 09:32 PM.

  4. #4
    hacker in training AdamLAN's Avatar
    Join Date
    Sep 2004
    Posts
    56
    <<<<UPDATE>>>>
    Ummmmmmm...............whats a registry scan?

  5. #5
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    Quote Originally Posted by AdamLAN
    <<<<UPDATE>>>>
    Ummmmmmm...............whats a registry scan?
    I might as well tell you this now, because you're going to learn it soon enough. A programmer needs to be very resourceful and self starting. You won't get much sympathy if you take an "I want somebody to hold my hand" attitude.

    The first thing you should have done when you didn't understand a term was to google it.

    Let's try it again from the top, except this time you use use the tools that are lying in front of you and go find out what a registry scan is.

    -Rog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with MSVC, Mingw32 and Code::Blocks
    By Brafil in forum C Programming
    Replies: 11
    Last Post: 10-12-2009, 11:34 AM
  2. MSVC resource script in Dev-C++
    By josh_d in forum Windows Programming
    Replies: 0
    Last Post: 03-17-2004, 04:07 PM
  3. MSVC behaves strange
    By ripper079 in forum C++ Programming
    Replies: 4
    Last Post: 10-28-2003, 08:34 PM
  4. Blender3D, XML, and MSVC ???
    By Grumpy_Old_Man in forum Game Programming
    Replies: 0
    Last Post: 08-24-2003, 07:00 PM
  5. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM