Click here to Skip to main content
16,012,168 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ and C programming Pin
BadKarma18-Jan-06 10:17
BadKarma18-Jan-06 10:17 
GeneralRe: Visual C++ and C programming Pin
Graham Bradshaw18-Jan-06 12:15
Graham Bradshaw18-Jan-06 12:15 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 12:34
thierrypp18-Jan-06 12:34 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 12:43
thierrypp18-Jan-06 12:43 
GeneralRe: Visual C++ and C programming Pin
thierrypp18-Jan-06 9:48
thierrypp18-Jan-06 9:48 
AnswerRe: Visual C++ and C programming Pin
Rage19-Jan-06 0:04
professionalRage19-Jan-06 0:04 
GeneralRe: Visual C++ and C programming Pin
thierrypp19-Jan-06 3:44
thierrypp19-Jan-06 3:44 
GeneralRe: Visual C++ and C programming Pin
Shraddhan22-Jan-06 19:22
Shraddhan22-Jan-06 19:22 
Thierry,

I approached this in a methodical way. Follow me and you should be OK:

In Visual C++ 6.0 create a new project. Choose Win 32 Console Application, select a simple application.

Delete the lines:
int main(int argc, char* argv[])
{
return 0;
}

Copy the code in. I used one of the examples you supplied.

Compile: get 5 errors, 1 warning. Looking at what the errors were, I deleted the following two lines which are clearly wrong:
#include
#include

The other three errors are about printf, scanf, strcmp not being recognised. I guess that I need to include some files. I moved the cursor on to the word printf and hit the F1 key. Visual C++ 6.0 gave some information on how to use this function. It also said that it needed the include file <stdio.h>. Same for scanf. For strcmp, Visual C++ 6.0 says that I need to include <syting.h>. So I added the next two lines.
#include <stdio.h>
#include <string.h>

Now there is a warning:
warning C4508: 'main' : function should return a value; 'void' return type assumed

Being just a warning, I could have ignored this. But to do the job properly, as I have been told that main() should return a value, I changed the line
main()

to be:
int main()

and to return a value, I added the following line just before the end of the main() function:
return 0;

Et voila! It compiles. And runs. No problemo, as they say. (And by the way, the source file that Visual C++ created is indeed .CPP, not .C)

Shraddhan
GeneralRe: Visual C++ and C programming Pin
Shraddhan22-Jan-06 19:28
Shraddhan22-Jan-06 19:28 
QuestionMFC GUI Pin
greendays_0118-Jan-06 7:36
greendays_0118-Jan-06 7:36 
AnswerRe: MFC GUI Pin
paragdoshi18-Jan-06 7:52
paragdoshi18-Jan-06 7:52 
AnswerRe: MFC GUI Pin
FarPointer18-Jan-06 8:01
FarPointer18-Jan-06 8:01 
GeneralRe: MFC GUI Pin
greendays_0118-Jan-06 8:18
greendays_0118-Jan-06 8:18 
GeneralRe: MFC GUI Pin
FarPointer18-Jan-06 8:38
FarPointer18-Jan-06 8:38 
AnswerRe: MFC GUI Pin
David Crow18-Jan-06 8:29
David Crow18-Jan-06 8:29 
GeneralRe: MFC GUI Pin
FarPointer18-Jan-06 8:49
FarPointer18-Jan-06 8:49 
GeneralRe: MFC GUI Pin
Owner drawn18-Jan-06 16:50
Owner drawn18-Jan-06 16:50 
QuestionViewer for installShield Express 2.2 Pin
jjmv18-Jan-06 7:23
jjmv18-Jan-06 7:23 
QuestionC++ to Assembly Pin
Tuotrut18-Jan-06 7:01
Tuotrut18-Jan-06 7:01 
AnswerRe: C++ to Assembly Pin
Maximilien18-Jan-06 7:24
Maximilien18-Jan-06 7:24 
AnswerRe: C++ to Assembly Pin
Rage18-Jan-06 7:33
professionalRage18-Jan-06 7:33 
GeneralRe: C++ to Assembly Pin
Tuotrut18-Jan-06 8:04
Tuotrut18-Jan-06 8:04 
GeneralRe: C++ to Assembly Pin
Maximilien18-Jan-06 8:21
Maximilien18-Jan-06 8:21 
GeneralRe: C++ to Assembly Pin
Tuotrut18-Jan-06 14:38
Tuotrut18-Jan-06 14:38 
GeneralRe: C++ to Assembly Pin
toxcct18-Jan-06 22:19
toxcct18-Jan-06 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.