Thread: Executing C Program in Visual Studio 2008

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Yes, a pure Win32 Console app.
    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.

  2. #17
    Registered User
    Join Date
    Feb 2008
    Posts
    14
    Still can't get it to work. Could someone please just send me a link to another C compiler

  3. #18
    Registered User
    Join Date
    Jan 2008
    Posts
    69
    Quote Originally Posted by rory-uk View Post
    Still can't get it to work. Could someone please just send me a link to another C compiler
    There are a couple out there. Google is a good resource to use. Personally, I prefer lcc-win32 for windows, which can be found at http://www.cs.virginia.edu/~lcc-win32/.

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    That's a shame it doesn't work for you. You're missing out of a terrific IDE.
    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. #20
    Registered User
    Join Date
    Feb 2009
    Posts
    1

    having problems

    i also am not getting c to run from VS 2005. can someone give me the steps
    i go to new project, click c++ and then WIN 32 console app. it opens up a few c++ files and a header file. i then try to add my file, main.c and put in a hello world, and doesnt compile, do you have to compile from command line, thanks for your help
    Jeremy

  6. #21
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    EDIT: This is answering jjfait, who is the poster above me.

    "it opens up a few c++ files and a header file"

    This is because it's opening the project as a C++ project, so adds some additional C++ code.

    File > New Project > WIN 32 console app > OK > Welcome to win32 application wizard > next > console ap + empty project > finish.

    This will create an empty project, with no C++ codes/files.
    Last edited by happyclown; 02-10-2009 at 07:18 PM.

  7. #22
    Registered User
    Join Date
    Apr 2009
    Posts
    1
    Quote Originally Posted by happyclown View Post
    EDIT: This is answering jjfait, who is the poster above me.

    "it opens up a few c++ files and a header file"

    This is because it's opening the project as a C++ project, so adds some additional C++ code.

    File > New Project > WIN 32 console app > OK > Welcome to win32 application wizard > next > console ap + empty project > finish.

    This will create an empty project, with no C++ codes/files.
    HAPPYCLOWN I COULD KISS YOU!!!!!!!!!!!!

    I love Visual Studio it's the only place I feel at home and now that I can program C in this baby I'm completely over the moon!

    Well... not completely over the moon... I don't really get kicks out of writing code... but let's just say you've solved a big problem of mine

  8. #23
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by mike_g View Post
    Well in VS2005 you press F5 to run with debug, or CTRL + F5 to run without it.
    what's the difference between the two?

  9. #24
    Registered User fsx's Avatar
    Join Date
    Apr 2009
    Posts
    29
    Quote Originally Posted by rory-uk View Post
    I am trying to teach myself C Programming. I need to know how to execute an application in Visual Studio 2008. I can't find a way to do this!!! It is only the first example aswell which is to simply print out hello


    You just need Visual C++ 2008 Express Visual Studio 2008 Express Editions and when you create new projects, do an EMPTY project from GENERAL projects, then when you add files, right click on SOURCE FILES and ADD NEW ITEM, then just name your file <filename>.c (remember to specify the extension when you name the file!) to override the default extension .cpp and the IDE and everything else will treat your code as C.

    Regards,
    FSX

  10. #25
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by BEN10 View Post
    what's the difference between the two?
    F5 starts the debugger. Obviously, the program runs slower in the debugger than without. Furthermore, in Debug mode, the console window disappears when the program does as opposed to non-debug mode (but you can use a breakpoint to avoid that).

    Also, you DON'T need an empty project. It will create a default project for you that will compile fine (although it creates a C++ file, but you can rename them). Remember that by default it also creates a precompiled header, which means you must add #include "stdafx.h" at the beginning of every source file.
    I'm not certain if it includes C++ headers in stdafx.h by default. I don't think so...
    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.

  11. #26
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by Elysia View Post
    F5 starts the debugger. Obviously, the program runs slower in the debugger than without. Furthermore, in Debug mode, the console window disappears when the program does as opposed to non-debug mode (but you can use a breakpoint to avoid that).

    Also, you DON'T need an empty project. It will create a default project for you that will compile fine (although it creates a C++ file, but you can rename them). Remember that by default it also creates a precompiled header, which means you must add #include "stdafx.h" at the beginning of every source file.
    I'm not certain if it includes C++ headers in stdafx.h by default. I don't think so...
    i usually press F5 to debug.can i start CNTRL+F5(it'll save me from writing getch()).will it affect my execution of the program in any way?and what is the difference between debugging and non-debugging?

  12. #27
    Registered User Sharke's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    303
    I agree that you should just use Visual Studio C++ Express Edition.

    It's a complete program, not a trial - and as a beginner I am finding it to be an absolutely superb IDE for learning how to program in C and C++. I've used various other IDEs with other languages and VSC++ is by far and away the best I've ever used. Intellisense is fantastic as a learning tool when you're starting out with things such as passing pointers to structs around and the like. There's many a time it's made me realize exactly what I was doing wrong. I love it.

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by BEN10 View Post
    i usually press F5 to debug.can i start CNTRL+F5(it'll save me from writing getch()).will it affect my execution of the program in any way?and what is the difference between debugging and non-debugging?
    You do know what a debugger is, I hope?
    The only difference is that your program will crash or you will get a runtime error dialog if something goes wrong in non-debugging mode. In debugging mode, the debugger will break where the error occurred.
    And debugging mode gives you access to debugging features, naturally.
    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.

  14. #29
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by Elysia View Post
    You do know what a debugger is, I hope?
    The only difference is that your program will crash or you will get a runtime error dialog if something goes wrong in non-debugging mode. In debugging mode, the debugger will break where the error occurred.
    And debugging mode gives you access to debugging features, naturally.
    Thanks Elysia. now i get it.
    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

  15. #30
    Registered User
    Join Date
    Jul 2009
    Posts
    1

    Question Can't compile C code in VS 2008

    Hi,

    My first post.

    I am trying to compile a C program in VS 2008. When I try to compile my simple "Hello World" program in C I get the following error.


    Error spawning rc.exe

    I created an empty win32 console application, then added a file Test.c


    Thanks,
    RFederer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OutputDebugString not working in Visual Studio 2008
    By jw232 in forum Windows Programming
    Replies: 3
    Last Post: 07-02-2009, 07:13 PM
  2. C & visual studio 2008
    By Red Maw in forum C Programming
    Replies: 2
    Last Post: 04-02-2009, 09:06 PM
  3. Visual Studio Express 2008 problems.
    By Normac in forum C++ Programming
    Replies: 2
    Last Post: 08-08-2007, 10:41 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM