TurboC3 not compiling basic programs help....

Thread Solved

Join Date: Jul 2009
Posts: 2
Reputation: yeshkadiyala is an unknown quantity at this point 
Solved Threads: 0
yeshkadiyala yeshkadiyala is offline Offline
Newbie Poster

TurboC3 not compiling basic programs help....

 
0
  #1
Jul 31st, 2009
Hello...

Im a newb to both C programming and DaniWeb ..

the prob is tht i try to compile this program in TurboC3

#include <stdio.h>
#include<Conio.h>

main()
{
printf( "hello" );
getch();
}

when i press " alt+F9 " it says " Warning:: program should return a value" and no errors

When i press " Alt + F5 " I see nothing but a black screen and cursor on it (like in logo) when i have to get Hello....

wht can be the problem...

anything wrong in the program?

plz help me...

regards
yesh
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,388
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1466
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: TurboC3 not compiling basic programs help....

 
0
  #2
Jul 31st, 2009
>>anything wrong in the program?

1. its int main().
2. Add return 0; as the last line in main()

3. Add '\n' to the end of Hello, making it "Hello\n"

4. You might need to add fflush(stdout) after that print statement.

If the above doesn't fix the problem then I don't know what's wrong.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 319
Reputation: Luckychap is on a distinguished road 
Solved Threads: 42
Luckychap's Avatar
Luckychap Luckychap is offline Offline
Posting Whiz

Re: TurboC3 not compiling basic programs help....

 
0
  #3
Jul 31st, 2009
As far as I know:

Alt + f9 -> just complile
use:
Ctrl + f9 -> compile + run

Last edited by Luckychap; Jul 31st, 2009 at 1:58 pm.
When you think you have done a lot, then be ready for YOUR downfall.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 92
Reputation: deepugtm has a little shameless behaviour in the past 
Solved Threads: 2
deepugtm deepugtm is offline Offline
Junior Poster in Training

Re: TurboC3 not compiling basic programs help....

 
-1
  #4
Aug 1st, 2009
If you write your program like this:

  1. #include <stdio.h>
  2. #include <conio.h>
  3. void main(){
  4. printf("\nHello World !!");
  5. getch();
  6. }


It should work..
Last edited by deepugtm; Aug 1st, 2009 at 7:25 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: itzAB is an unknown quantity at this point 
Solved Threads: 2
itzAB itzAB is offline Offline
Light Poster

Re: TurboC3 not compiling basic programs help....

 
0
  #5
Aug 1st, 2009
I am too new to c programming.I think as the program doesnt return any value you should either put void main,or give return 0 at the end of program.
Just take it as a suggestion not sure if it is tha solution.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: TurboC3 not compiling basic programs help....

 
0
  #6
Aug 1st, 2009
Originally Posted by itzAB View Post
I am too new to c programming.I think as the program doesnt return any value you should either put void main,
NEVER use void main()
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 36
Reputation: 9868 is on a distinguished road 
Solved Threads: 7
9868 9868 is offline Offline
Light Poster

Re: TurboC3 not compiling basic programs help....

 
0
  #7
Aug 2nd, 2009
Originally Posted by yeshkadiyala View Post
Hello...

Im a newb to both C programming and DaniWeb ..

the prob is tht i try to compile this program in TurboC3

#include <stdio.h>
#include<Conio.h>

main()
{
printf( "hello" );
getch();
}

when i press " alt+F9 " it says " Warning:: program should return a value" and no errors

When i press " Alt + F5 " I see nothing but a black screen and cursor on it (like in logo) when i have to get Hello....

wht can be the problem...

anything wrong in the program?

plz help me...

regards
yesh
1.CTRL+F9: to see the output
2. main should return int and nothing else
3. C is case sensitive, so Conio.h is wrong.
4. If I'm not wrong, ALT+F5 is used to hold the screen if you're not using getch().
5. Use code-tags to post your code.
Last edited by 9868; Aug 2nd, 2009 at 3:25 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 201
Reputation: yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold 
Solved Threads: 35
yellowSnow's Avatar
yellowSnow yellowSnow is offline Offline
Posting Whiz in Training

Re: TurboC3 not compiling basic programs help....

 
1
  #8
Aug 2nd, 2009
@OP
I apologise if this remark seems a little out of place with respect to your query, but I would suggest that you look at using an up-to-date setup. Turbo C is pretty dated.

Personally, for the Windows platform, I would recommend the MinGW toolchain in conjunction with your favourite editor or IDE. Codeblocks is a good IDE option and you can download it with MinGW as part of the package.

I use MinGW in conjunction with the CDT tooling in Eclipse. It works well - except that there are still some integration issues with the gdb debugger - but it's not a "show-stopper".
Last edited by yellowSnow; Aug 2nd, 2009 at 6:32 am.
Manic twiddler of bits
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 201
Reputation: yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold yellowSnow is a splendid one to behold 
Solved Threads: 35
yellowSnow's Avatar
yellowSnow yellowSnow is offline Offline
Posting Whiz in Training

Re: TurboC3 not compiling basic programs help....

 
0
  #9
Aug 2nd, 2009
I should have posted this in my previous blurb. Here's a link to a sticky post at the head of the C forums page:

http://www.daniweb.com/forums/thread50370.html
Manic twiddler of bits
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 2
Reputation: yeshkadiyala is an unknown quantity at this point 
Solved Threads: 0
yeshkadiyala yeshkadiyala is offline Offline
Newbie Poster

Re: TurboC3 not compiling basic programs help....

 
0
  #10
Aug 5th, 2009
u guys are gr8 ... thnx

by the way it worked for me... when I pressed ctrl + f9 & then alt+f5

and no matter wht I used ..
main() or void main() or int main() it worked for me

and return 0; solved the warning problem

thank u guys once again...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC