Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. programming C in Visual C++ express edition.

programming C in Visual C++ express edition.

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiondelphihardware
23 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D David Crow

    Given this and your other comments, maybe you should hold off on the 'microcontroller projects' until you have a better understanding of development. Otherwise, you'll just end up frustrated.

    "One man's wage rise is another man's price increase." - Harold Wilson

    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

    "Man who follows car will be exhausted." - Confucius

    C Offline
    C Offline
    cavemen
    wrote on last edited by
    #13

    I am not talking about microcontrollers right now. I will get to that. Here is the question. So I have Microsoft Visual C++ Express edition and I am struggling to create a C console application. I am not sure how I ADD a stdio.h header and a main source file to accept the C code. I am sure it is possible, it is just that al defaults in VC++ are for C++ and object-oriented programs I won't need for a while. I can create a class. I can create a header file. I can't create a plain code file. I don't know what to type into the header file. Thank you.

    D 1 Reply Last reply
    0
    • C cavemen

      I am not talking about microcontrollers right now. I will get to that. Here is the question. So I have Microsoft Visual C++ Express edition and I am struggling to create a C console application. I am not sure how I ADD a stdio.h header and a main source file to accept the C code. I am sure it is possible, it is just that al defaults in VC++ are for C++ and object-oriented programs I won't need for a while. I can create a class. I can create a header file. I can't create a plain code file. I don't know what to type into the header file. Thank you.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #14

      cavemen wrote:

      So I have Microsoft Visual C++ Express edition and I am struggling to create a C console application. I am not sure how I ADD a stdio.h header and a main source file to accept the C code.

      From the File menu, click New then Project. In the New Project dialog, select Win32 Console Application. Give the project a name, and verify the Location. No need for a Solution. In the Application Wizard dialog, just accept the defaults. In the Solution Explorer pane on the left, right-click Source Files and select Add then New Item. Add a C++ file, and give it a name. That file should show up in the left pane under Source Files. Double-click it to start editing. Add something like the following to it:

      #include <stdio.h>

      void main( void )
      {
      printf("Hello World\n");
      }

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      C 1 Reply Last reply
      0
      • D David Crow

        cavemen wrote:

        So I have Microsoft Visual C++ Express edition and I am struggling to create a C console application. I am not sure how I ADD a stdio.h header and a main source file to accept the C code.

        From the File menu, click New then Project. In the New Project dialog, select Win32 Console Application. Give the project a name, and verify the Location. No need for a Solution. In the Application Wizard dialog, just accept the defaults. In the Solution Explorer pane on the left, right-click Source Files and select Add then New Item. Add a C++ file, and give it a name. That file should show up in the left pane under Source Files. Double-click it to start editing. Add something like the following to it:

        #include <stdio.h>

        void main( void )
        {
        printf("Hello World\n");
        }

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Man who follows car will be exhausted." - Confucius

        C Offline
        C Offline
        cavemen
        wrote on last edited by
        #15

        Thank you. But when I try to run the empty project it tells me that it cannot find a file path to my project "lesson1\debug\lesson1.exe" (lesson1 is my first project name) this message pops out, nomatter where I create it, the desktop or the default vc++ folder in my documents.

        D 1 Reply Last reply
        0
        • S sunlin7

          You need to add the sdk information to your Visual Studio. e.g: add "D:\Program Files\Microsoft SDKs\Windows\v6.0A\bin" to "Executable files", add "D:\Program Files\Microsoft SDKs\Windows\v6.0A\Include" to "Include files", add "D:\Program Files\Microsoft SDKs\Windows\v6.0A\lib" to "Libraray files", ... Please check these settings of Visual Studio on your machine.

          C Offline
          C Offline
          cavemen
          wrote on last edited by
          #16

          not sure where i do that

          S 1 Reply Last reply
          0
          • C cavemen

            Thank you. But when I try to run the empty project it tells me that it cannot find a file path to my project "lesson1\debug\lesson1.exe" (lesson1 is my first project name) this message pops out, nomatter where I create it, the desktop or the default vc++ folder in my documents.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #17

            cavemen wrote:

            But when I try to run the empty project it tells me that it cannot find a file path to my project...

            Have you tried Googling for the error number/message?

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Man who follows car will be exhausted." - Confucius

            C 1 Reply Last reply
            0
            • D David Crow

              cavemen wrote:

              But when I try to run the empty project it tells me that it cannot find a file path to my project...

              Have you tried Googling for the error number/message?

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Man who follows car will be exhausted." - Confucius

              C Offline
              C Offline
              cavemen
              wrote on last edited by
              #18

              I did. I had to hit "build solution" before running it. However it doesn't want to compile the #include void main( void ) { printf("Hello World\n"); } The building information in "Output" tells me that there is one error the compiler had to skip somewhere.

              D C 2 Replies Last reply
              0
              • C cavemen

                I did. I had to hit "build solution" before running it. However it doesn't want to compile the #include void main( void ) { printf("Hello World\n"); } The building information in "Output" tells me that there is one error the compiler had to skip somewhere.

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #19

                cavemen wrote:

                The building information in "Output" tells me that there is one error...

                What error? What line?

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "Man who follows car will be exhausted." - Confucius

                C 1 Reply Last reply
                0
                • D David Crow

                  cavemen wrote:

                  The building information in "Output" tells me that there is one error...

                  What error? What line?

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "Man who follows car will be exhausted." - Confucius

                  C Offline
                  C Offline
                  cavemen
                  wrote on last edited by
                  #20

                  ------ Build started: Project: Lesson1_2, Configuration: Debug Win32 ------ Compiling... Lesson1_2.cpp Hello world.cpp c:\documents and settings\safeuser\my documents\visual studio 2008\projects\lesson1_2\lesson1_2\hello world.cpp(1) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? Generating Code... Build log was saved at "file://c:\Documents and Settings\SafeUser\My Documents\Visual Studio 2008\Projects\Lesson1_2\Lesson1_2\Debug\BuildLog.htm" Lesson1_2 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

                  D 1 Reply Last reply
                  0
                  • C cavemen

                    ------ Build started: Project: Lesson1_2, Configuration: Debug Win32 ------ Compiling... Lesson1_2.cpp Hello world.cpp c:\documents and settings\safeuser\my documents\visual studio 2008\projects\lesson1_2\lesson1_2\hello world.cpp(1) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? Generating Code... Build log was saved at "file://c:\Documents and Settings\SafeUser\My Documents\Visual Studio 2008\Projects\Lesson1_2\Lesson1_2\Debug\BuildLog.htm" Lesson1_2 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #21

                    cavemen wrote:

                    c:\documents and settings\safeuser\my documents\visual studio 2008\projects\lesson1_2\lesson1_2\hello world.cpp(1) : fatal error C1010: unexpected end of file while looking for precompiled header.

                    See here.

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    1 Reply Last reply
                    0
                    • C cavemen

                      not sure where i do that

                      S Offline
                      S Offline
                      sunlin7
                      wrote on last edited by
                      #22

                      You need run VisualStudio, then choose the follow options begin from "Tools" menu: "Tools->Options...->Project and solutions->VC++ Directories" you can set the executable/libraray/include directories now.

                      1 Reply Last reply
                      0
                      • C cavemen

                        I did. I had to hit "build solution" before running it. However it doesn't want to compile the #include void main( void ) { printf("Hello World\n"); } The building information in "Output" tells me that there is one error the compiler had to skip somewhere.

                        C Offline
                        C Offline
                        cavemen
                        wrote on last edited by
                        #23

                        PROBLEM SOLVED thank you everybody for your time I had to start EMPTY CONSOLE project and add my C++ code file to that. NO pricompiled headers. (I don't even know what they do)

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups