Beginner question about compiling and visual studio

This is a discussion on Beginner question about compiling and visual studio within the C Programming forums, part of the General Programming Boards category; I am new to programming with C and visual studio. When I open a .c file with visual studio 2005, ...

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    7

    Beginner question about compiling and visual studio

    I am new to programming with C and visual studio. When I open a .c file with visual studio 2005, can any tell me how I actually compile it? Also, can anyone tell me why the "Start Debugging" option is grayed out?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    i dont have access to VS right now, but i thought the "Compile" option was in some menu at the top, like "Project". if the debug option is disabled, i imagine any building/compiling options are also disabled.

    i think VS requires you to make a project, even an "Empty Project". after that, add your files to the project and look for the options again, which should be enabled.

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    7
    Ok, i created a new empty project, opened my .c file, and went to Build Project. Then I received this error: 'Sub Main' was not found in 'Project1'.

    Here is my code:
    Code:
    #include <stdio.h>
    
    int main( void )
    {
    	printf( "Test\n");
    	return 0;
    }

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    > 'Sub Main' was not found in 'Project1'.
    sub main sounds more like you created a VisualBasic project, not a C++ project.
    You need to start with a C++ console project
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by GibsMe View Post
    Ok, i created a new empty project, opened my .c file, and went to Build Project. Then I received this error: 'Sub Main' was not found in 'Project1'.

    Here is my code:
    Code:
    #include <stdio.h>
    
    int main( void )
    {
    	printf( "Test\n");
    	return 0;
    }
    Follow this procedure:

    1 New Project
    2 Click Win32/64 console Applicaiton
    3 Enter project name
    4 Disable pre-defined header files
    5 Click Ok
    6 Click "Add to project"
    7 Click .cpp file
    8 Name it <file name here> .c <- VERY IMPORTANT
    9 Click OK
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  2. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  3. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21