943,916 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1908
  • C RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 15th, 2006
0

Re: realy fresh to C

#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
return 0;
}

can you eplain me all...please

vhen running your file it happens nothing
an@jan-desktop:~$ gcc rep.c
jan@jan-desktop:~$ gcc rep.c
jan@jan-desktop:~$ gcc rep.c
jan@jan-desktop:~$
Last edited by jan1024188; Sep 15th, 2006 at 5:36 pm.
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006
Sep 15th, 2006
0

Re: realy fresh to C

gcc only compiles your program into an executable file, it does not run your program. The default name of your program is a.out because you did not tell gcc what to name it. So to run your program, try this:
  1. ./a.out <Enter key>
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Sep 15th, 2006
0

Re: realy fresh to C

jan@jan-desktop:~$ ./a.out <Enter key>
bash: syntax error near unexpected token `newline'
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006
Sep 15th, 2006
0

Re: realy fresh to C

Use ls command to search the directory and see if it contains a file called a.out. If not, then gcc probably did not compile it. If it didn't then compare your program with what ~S.O.S.~ posted and make sure it is identical. And from here I think you need to start reading some of the links that were posted in the sticky at the top of this board. I know its a lot of reading, but if you want to learn how to program you must also be willing to do a lot of reading and studying.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Sep 15th, 2006
0

Re: realy fresh to C

yes file is there but i cant open it....im gonna buy this book anyway
http://www.amazon.com/Absolute-Begin...e=UTF8&s=books
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006
Sep 15th, 2006
0

Re: realy fresh to C

Its good that you are going to buy a book, that's the best way to learn. But that book won't teach you a thing about gcc compiler or how to use linux. you need to learn how to compile and execute a program before that book (or most any other book for that matter) will be much help to you.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Sep 15th, 2006
0

Re: realy fresh to C

oh actualy i have another book with chapter programming tools which is including all that .....

so what with that file...im not able to open it
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006
Sep 15th, 2006
0

Re: realy fresh to C

Click to Expand / Collapse  Quote originally posted by jan1024188 ...
jan@jan-desktop:~$ ./a.out <Enter key>
bash: syntax error near unexpected token `newline'
I did not mean for you to type "<Enter key>" on the command line -- that only meant that you should have hit the Enter key on the keyboard. If you actually typed that text, then try it again without that part. just
  1. $ ./a.out
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Sep 15th, 2006
1

Re: realy fresh to C

thanks but i discovered that by myself....
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: CString Convert to LPCTSTR
Next Thread in C Forum Timeline: C programming - need some help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC