How to create a C project in Microsoft Visual C++ 6.0

This is a discussion on How to create a C project in Microsoft Visual C++ 6.0 within the C Programming forums, part of the General Programming Boards category; Hi, I'm trying to teach myself C (NOT C++ yet) but I'm having trouble with my Microsoft Visual C++ 6.0. ...

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    4

    How to create a C project in Microsoft Visual C++ 6.0

    Hi,
    I'm trying to teach myself C (NOT C++ yet) but I'm having trouble with my Microsoft Visual C++ 6.0. I want to try writing some simple programs but I can't find any information online about how to create a C project in Visual C++ 6.0. All I see are C++ projects!

    So far, all I've been able to accomplish are small apps from the command line using notepad, as well as some partially successful attempts in Eclipse Helios CDT. I also downloaded the free trial of the newer version Visual Studio 2010 Express to see if that would work better.... I can create a project & "name" it with a .c but it always ends up .cpp anway.

    6.0 won't even let me create a project... I keep getting this error: "The name specified is not a valid name for a project" when I try to add .c

    Sorry if this is a vague question... but once I can actually start coding in Visual 6.0, then I'm sure I'll have more programming inquiries

    Thanks in advance,
    Linziza

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    If you are trying to learn C from the beginning I would suggest using a different environment, primarily because the C compiler in Visual Studio is not compliant with the C99 standard.

    Download CodeBlocks IDE (which is free) and install GCC as a compiler, and you are all set to go without having to worry about the fancy features Visual Studio offers(which may only get in your way at this point).
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    1) File >> New >> Win32 Console Application

    2) On the right side, give the project a name and click OK

    3) Select "Empty project" and then OK, from the next choices, (the Wizard, it's called, I believe).

    4) File >> New >> Files Tab in the displayed Window >> C++ Source File. Uncheck the "Add to Project" box, >> OK.

    Open your Workspace for your new project. When you click to run it, it will ask if you want your source file in the edit window, added to to project? Click Yes.

    I believe that's everything I do. If it doesn't work, for you, let me know. I do have a far more verbose guideline, but it's not at hand, atm.

    By default, files ending with dot c should be compiled by your C compiler, only, and dot cpp files get the C++ compiler.

    As you might guess, you can change those settings if they aren't what you want.

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    You should really get rid of stoneage software. Use the 2010 Express edition (if you're going to use Visual Studio; Code::Blocks is also fine).
    These are steps for Visual Studio:
    Create a project as usual. The project can be used for both C/C++. Make sure it's a console project.
    Then, when you add new files to the project, simply give them a .c extension and it will compile as C code.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Jul 2010
    Posts
    4
    Great... Thanks everyone (esp. Adak). Ok so I was able to create a project and type in a small program but now how do I run it? I've used other programming environments and there's always been a Run button or at least a Run menu on the menu bar or a way to access it. I've compiled & Built the program but I'm not seeing any output as I should.

    Also, Elysia & Claudiu, I too, would prefer to use newer/ better software but I am a student intern and VS 6.0 is just what they use around here... I intern in a business which writes software for medical devices. They pretty much exclusively use C in this software so, to learn from the "masters" over here, I really need to familiarize myself with their tools.

    Thanks again for your help!

    UPDATE: I found on another site where I have to hit CTRL-F5 to make it run.... now the console pops up! Thanks anyway!
    Last edited by linziza; 07-20-2010 at 06:45 AM. Reason: found answer...

  6. #6
    Registered User
    Join Date
    Jul 2010
    Posts
    4
    does anyone know how to mark this thread as RESOLVED?

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    It's resolved when you say thanks, and everyone stops responding.

    That is, until some brain-dead doofus wanders past a few years later with some "me too" comment.
    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.

  8. #8
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    I know I'm early, but... ME TOO!!! How do I mark this thread resolved?

  9. #9
    Registered User
    Join Date
    Jul 2010
    Posts
    4
    ha ha

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 07:13 PM
  2. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  3. Microsoft Visual C++ 6.0 ** Am I missing something?
    By Intimd8r in forum C Programming
    Replies: 9
    Last Post: 05-15-2002, 03:21 AM
  4. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM

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