programming C in Visual C++ express edition.
-
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
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.
-
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.
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
-
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
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.
-
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.
-
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.
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
-
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
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.
-
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.
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
-
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
------ 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 ==========
-
------ 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 ==========
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
-
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.