Thread: Simple Question about VC++ .NET 2003

  1. #1
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53

    Simple Question about VC++ .NET 2003

    I try to "Add Existing Item" to a project, and when I add a .h or .cpp file, it doesn't show up in my "Resource View". I wish I knew where these files I'm adding are going, if they are even being added in the first place!

    I figured I have to add header files to my project in order to reference them in my code. I try:

    #include <iostream.h> --and-- #include "iostream.h"

    and neither of these work. I get an error saying unexpected end of header file.

    I appreciate all help! Thanks for your time everyone!
    --MrDoomMaster
    The kind of DooM that makes the MooD

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I think "Resource View" shows your resource script files. There should be a tab that lets you switch to source code view. I can't remember the name though.

    > #include <iostream.h>

    Did you try <iostream>?

  3. #3
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53
    Yeah, but I thought the Resource View showed all of the source and header files that are used in the project, kind of to organize it. You wouldn't just use ONE .cpp file for the entire program, would you? You would have .dll files, more .cpp files, .h files... these should all show up in "directory form" on the Resource View, correct? Eh, I feel like I'm missing some important elements... if someone could help uncramp my brain, I would appreciate it lol. Thanks everyone!


    Also, "#include <iostream>" didn't work either! ahhhhhh!
    Last edited by MrDoomMaster; 11-14-2003 at 11:59 AM.
    --MrDoomMaster
    The kind of DooM that makes the MooD

  4. #4
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    no, what he is saying is this:

    there are three tabviews in VC++, one tab is resource view, this will give your different resource scripts and the objects they contain. Then there is the "classview" tab, which shows what classes your program has defined, and the member functions/variables. then, next to that is the "fileview" tab, which shows ALL files that are part of the project, .h, .cpp, .rc, .txt,etc. doesnt matter, it shows them all.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Exclamation Resource has a specific meaning -

    In Windows terminology, a resource is something that's included in the exe file which is NOT machine code. For example the program's icon is a resource... and, I forget what else... maybe drop-down menus are resources.

    I'm not sure what the <iostream> problem is... Maybe it has something to do with the project type... it should work with a Windows console application... I'm not sure if it will work in a real Windows application.

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Resource view is not for your header files, only for things like dialogs, string tables, icons, menus, etc.

    You want to look at "solution explorer" for managing your .cpp files.

    As for iostream, all you need to do is put the line "#include <iostream>" in your .cpp file; header files in solution explorer are never needed, but it's a fast way to open headers you want to edit.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  7. #7
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53
    Oh, thanks guys! I finally understand how to organize my project now. Well, as for the header problem, it won't compile my test program unless the header works. Here is my program:

    Code:
    //Decision
    
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	enum animal(cats, dogs, fish, horses);
    
    	animal anchoice;
    	anchoice = 0;
    
    	cout << "Pick a number 1-4";
    	cin >> anchoice;
    
    	anchoicechoice = anchoice - 1;
    
    	cout << "You chose " << animal(anchoice) << " as your animal";
    	return 0;
    }
    Keep in mind, I'm sure theres TONS of mistakes in the main function, but please don't worry about that. I was going to test it for myself and find out the problems myself, so I could learn from my mistakes. But I can't check the body until the header starts working. This is a windows console app, I hope someone can help me out.

    Here is the error I get:



    ------ Build started: Project: Test1, Configuration: Debug Win32 ------

    Compiling...
    Decision1.cpp
    Decision1.cpp(21) : fatal error C1010: unexpected end of file while looking for precompiled header directive

    Build log was saved at "file://c:\Programming Projects\Test1\Debug\BuildLog.htm"
    Test1 - 1 error(s), 0 warning(s)


    ---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped
    --MrDoomMaster
    The kind of DooM that makes the MooD

  8. #8
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Go to solution explorer. Right click your project (it's one level down from the very top, which is the solution). Click on Properties.

    In the new window, go to C/C++, then Precompiled headers. Make sure in the upper left you are setting the properties for "All Configurations". Change the first option to "not using precompiled headers".

    The problem is, your project is set up to default to using the VC++ "stdafx.h" auto-generated file, and for this project you don't want that.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  9. #9
    Registered User MrDoomMaster's Avatar
    Join Date
    Oct 2003
    Posts
    53
    wow, thanks man! that really helped!
    --MrDoomMaster
    The kind of DooM that makes the MooD

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Question!!
    By gameuser in forum C++ Programming
    Replies: 2
    Last Post: 06-06-2009, 05:42 PM
  2. Simple question about the C programming tutorial #1
    By elsheepo in forum C Programming
    Replies: 13
    Last Post: 01-19-2009, 08:59 PM
  3. .NET 2003 IDE Question
    By Noose in forum C++ Programming
    Replies: 3
    Last Post: 08-10-2007, 04:03 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. question about .net to 6.0 change causing errors
    By jverkoey in forum C++ Programming
    Replies: 17
    Last Post: 03-23-2004, 10:45 AM