programming C in Visual C++ express edition.
-
no maybe i should switch to a different compiler visual studio professional is very big too big for my computer
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 need to learn C because I am about to develop microcontroller projects that use C. I got books about C. I might need C++ in the future, but for totally different things. Is it possible to use stdio.h in MS Visual C++? How do I do so? How do I keep command prompt applications from closing the console after they are done playing? If i want to see my "hello world" or some variable number output. Is Keil uVision the only compiler to suit ARM microcontrollers? Maybe I need something like Borland compiler so I can write ARM code and PC code on the same compiler? Thank you.
Yes you can use stdio.h - VC++ has been a pretty C89 standard compliant C compiler since about 1997. It's unlikely to grow any C99 features in the short term though. Use CTRL+F5 to run your code - then the console window window won't close when the program exits. It'll just sit there with a "press any key to continue..." message. There are loads of compilers that support ARM. I've used gcc for developing on mobile phones and some of my collegues have used a couple of proprietary compilers as well. Doing a quick google for "ARM C compiler" gave me 8 relevant hits on the first page. Cheers, Ash
-
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.