Compile C program in Visual Studio 2005

N

Nicholas Zhou

Sorry if this sounds stupid. I am a total newbie....

Can I compile C program in Visual Studio 2005 IDE? I wrote the simple
"Hello World" program in it:

------------------------------------

#include <stdio.h>

main()
{
printf("hello, world!\n");
}

--------------------------------------

When I run it, it gives me the following:

-------------------------------------------------------------------------
'HelloWorld2.exe': Loaded
'D:\VS\Projects\HelloWorld2\debug\HelloWorld2.exe', Binary was not built
with debug information.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols
loaded.
The thread 'Win32 Thread' (0x4e8) has exited with code 0 (0x0).
The program '[5968] HelloWorld2.exe: Native' has exited with code 0 (0x0).

-------------------------------------------------------------------------


Any suggestions? Please advice. Thanks a million!

Regards,

Nick
 
S

Scooter

Yes you can

The program compiled and lin ked properly. When you created the project
did you create it as a console application. Also run the application
from the command line not inside the ide. inside the ide the program
will end and close the console window.
 
L

Lane Straatman

Scooter said:
Yes you can

The program compiled and lin ked properly. When you created the project
did you create it as a console application. Also run the application
from the command line not inside the ide. inside the ide the program
will end and close the console window.
You're gonna get flamed if you continue to go on about the details of your
IDE, which has nothing to do with ISO C. At least have a proper main call
which is
int main(void)
There's certainly a NG with the word microsoft in it where you'll find that
your questions find a better response. LS
 
N

Nelu

Nicholas Zhou said:
Sorry if this sounds stupid. I am a total newbie....

Can I compile C program in Visual Studio 2005 IDE? I wrote the simple
"Hello World" program in it:

Yes. Make sure the files have the .c extension instead of .cpp so it
compiles the source as C and not as C++.
#include <stdio.h>

main()

If you write it as
int main(void)
you would remember that you should return something when the function
ends and main returns int.
{
printf("hello, world!\n");

add:

getchar();

so you make sure that the console stays opened until you press Enter.
This way you get to read the output. Make sure you have a console
project.

add:
return 0;

}

--------------------------------------

When I run it, it gives me the following:

-------------------------------------------------------------------------
'HelloWorld2.exe': Loaded
'D:\VS\Projects\HelloWorld2\debug\HelloWorld2.exe', Binary was not built
with debug information.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols
loaded.
The thread 'Win32 Thread' (0x4e8) has exited with code 0 (0x0).
The program '[5968] HelloWorld2.exe: Native' has exited with code 0 (0x0).

The last line says that your program ran and returned with code 0.
 
M

madhawi

u write the program in console project. that is when u would select the
new project, u select the console application.
u try it and reply to me.
Nicholas Zhou said:
Sorry if this sounds stupid. I am a total newbie....
Can I compile C program in Visual Studio 2005 IDE? I wrote the simple
"Hello World" program in it:Yes. Make sure the files have the .c extension instead of .cpp so it
compiles the source as C and not as C++.
#include <stdio.h>
main()If you write it as
int main(void)
you would remember that you should return something when the function
ends and main returns int.
{
printf("hello, world!\n");add:

getchar();

so you make sure that the console stays opened until you press Enter.
This way you get to read the output. Make sure you have a console
project.

add:
return 0;




}

When I run it, it gives me the following:
-------------------------------------------------------------------------
'HelloWorld2.exe': Loaded
'D:\VS\Projects\HelloWorld2\debug\HelloWorld2.exe', Binary was not built
with debug information.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', No symbols
loaded.
'HelloWorld2.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols
loaded.
The thread 'Win32 Thread' (0x4e8) has exited with code 0 (0x0).
The program '[5968] HelloWorld2.exe: Native' has exited with code 0 (0x0).The last line says that your program ran and returned with code 0.
 
S

santosh

madhawi said:
u write the program in console project. that is when u would select the
new project, u select the console application.
u try it and reply to me.

Please use proper English words instead of indecipherable abbreviations
like 'u', '4' etc.
 
C

CBFalconer

madhawi said:
u write the program in console project. that is when u would select
the new project, u select the console application.
u try it and reply to me.

The combination of rude top-posting and incomprehensible geek-speek
makes this a totally useless reply to a patently off-topic
article. Please review the following links before further
disruption of newsgroups.

--
Some informative links:
<http://members.fortunecity.com/nnqweb/> (newusers)
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/> (taming google)
 
Y

Yevgen Muntyan

CBFalconer said:
The combination of rude top-posting and incomprehensible geek-speek
makes this a totally useless reply to a patently off-topic
article. Please review the following links before further
disruption of newsgroups.

Could you stop recommending this one:

<http://members.fortunecity.com/nnqweb/>

You are telling people to visit a site which contains some links
to somewhere; that "somewhere" is something you have to discover
by clicking those links and getting popups or "Click to skip
advertisement" garbage.

Note, try this link with a virgin browser without any fancy network
settings you told you have. Try it as an innocent guy with mozilla
or IE would do.

By doing this you are doing more harm than good: most people
getting this template response from you simply ignore you (naturally),
but those who do not will get to that garbage site, and will ignore you
too; and they won't try next links even though they are actually not
bad. And as the result you simply add to the "further disruption of
newsgroups".

Regards,
Yevgen
 
C

CBFalconer

Yevgen said:
.... snip ...

Could you stop recommending this one:

<http://members.fortunecity.com/nnqweb/>

You are telling people to visit a site which contains some links
to somewhere; that "somewhere" is something you have to discover
by clicking those links and getting popups or "Click to skip
advertisement" garbage.

Note, try this link with a virgin browser without any fancy network
settings you told you have. Try it as an innocent guy with mozilla
or IE would do.

By doing this you are doing more harm than good: most people
getting this template response from you simply ignore you
(naturally), but those who do not will get to that garbage site,
and will ignore you too; and they won't try next links even though
they are actually not bad. And as the result you simply add to the
"further disruption of newsgroups".

I compromised. I moved it to the last of the links. It does lead
to valuable information.
 
L

Lane Straatman

CBFalconer said:
I compromised. I moved it to the last of the links. It does lead
to valuable information.
There's no one in clc who improves the quality of posts more than does
Chuck. Usenet is a strange place, and getting a feel for the territory
helps with the critical task of getting posts in the correct ng. LS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top