473,511 Members | 15,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting started with C on my Linux machine.

I would like to get started with programming in C, but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

Greetings Tobias

Jul 26 '06 #1
13 1737
ThaDoctor wrote:
>
I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.
The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

--
pete
Jul 26 '06 #2

pete skrev:
ThaDoctor wrote:

I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

--
pete
and after I have written and cmpiled how do I run the program under
linux ?

Jul 26 '06 #3

pete skrev:
ThaDoctor wrote:

I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

--
pete
And after this how do I run the program under linux ?

Jul 26 '06 #4
ThaDoctor <To*********@gmail.comwrote:
and after I have written and cmpiled how do I run the program under
linux ?
<ot>
Run a.out. man gcc for details, assuming that's your compiler.
Take further questions to comp.unix.programmer.
</ot>

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
Jul 26 '06 #5

ThaDoctor wrote:
pete skrev:
ThaDoctor wrote:
I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.
The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

and after I have written and cmpiled how do I run the program under
linux ?
% gcc hello_world.c -o hi # compile the program
% ./hi # execute the program

In the above, '%' represents your command prompt.
Your questions are not really appropriate in this
newsgroup, but once you've figured out the basics
and have questions about the C language, those
questions will probably be topical. Make sure
to read the faq:

http://www.c-faq.com/

Jul 26 '06 #6
cp
Go to the place where you "saved" the compiled file and write: ./<program>
That is: dotSLASH<program-name>
Jul 26 '06 #7
ThaDoctor wrote:
>
pete skrev:
>ThaDoctor wrote:
>
I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

--
pete

And after this how do I run the program under linux ?
The same way you run any other program in Linux, which, if
you ran the compiler, you presumably already know.

--
Chris "programPathOrNameAlongPath RETURN" Dollin
A rock is not a fact. A rock is a rock.

Jul 27 '06 #8

Chris Dollin wrote:
ThaDoctor wrote:

pete skrev:
ThaDoctor wrote:

I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

--
pete
And after this how do I run the program under linux ?

The same way you run any other program in Linux, which, if
you ran the compiler, you presumably already know.
How does it follow from running the compiler by invoking
"gcc hello.c" that one runs the program by typing "./a.out"?
>
--
Chris "programPathOrNameAlongPath RETURN" Dollin
A rock is not a fact. A rock is a rock.
Jul 27 '06 #9
me********@aol.com wrote:
>
Chris Dollin wrote:
>ThaDoctor wrote:
>
pete skrev:

ThaDoctor wrote:

I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.

--
pete

And after this how do I run the program under linux ?

The same way you run any other program in Linux, which, if
you ran the compiler, you presumably already know.

How does it follow from running the compiler by invoking
"gcc hello.c" that one runs the program by typing "./a.out"?
Because in both cases -- more than both, since the OP presumably
knows more Linux commands than just `gcc` -- one types an
abbreviated version of the program's name.

The /real/ answer to the OPs question is, I suppose, "Usenet
is not, and is not intended to be, a substitute for an
actual person bootstrapping you."

--
Chris "finder" Dollin
"The path to the web becomes deeper and wider" - October Project

Jul 27 '06 #10
me********@aol.com wrote:
Chris Dollin wrote:
ThaDoctor wrote:
>
pete skrev:
>
>ThaDoctor wrote:
>
I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.
>>
>The whole point of the Hello World program,
>is to gain enough familiarity with your C implementation
>to write, translate, and execute a C program.
>>
>--
>pete
>
And after this how do I run the program under linux ?
The same way you run any other program in Linux, which, if
you ran the compiler, you presumably already know.

How does it follow from running the compiler by invoking
"gcc hello.c" that one runs the program by typing "./a.out"?
umteenth_out_of_topic_post {

Because the compiler as a default will create an executable
with name a.out (derived from "assembler output") in your
working directory. In Unix a single dot (.) is shorthand for
your working directory. So typing "./a.out" (without the quotes)
tells to the operating system to execute the file in the working
directory with name a.out Of course such a file will be created
only if the compilation completed without poblems.

If dot (.) appears in your PATH variable then you can simply type
a.out If you didn't understand the last sentence you can safely
ignore it.
}

Christopher Benson-Manica wrote:
ThaDoctor <To*********@gmail.comwrote:
and after I have written and cmpiled how do I run the program under
linux ?

<ot>
Run a.out. man gcc for details, assuming that's your compiler.
Take further questions to comp.unix.programmer.
</ot>
I don't think that a beginner will get much out of the gcc man page.
Bill Pursell wrote:
ThaDoctor wrote:
pete skrev:
ThaDoctor wrote:
I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.
>
The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.
and after I have written and cmpiled how do I run the program under
linux ?

% gcc hello_world.c -o hi # compile the program
% ./hi # execute the program
There is a pitfall here in that if there's already a file with name
"hi",
then the compilation command will silently overwrite it.

Spiros Bousbouras

Jul 27 '06 #11

sp****@gmail.com wrote:
me********@aol.com wrote:
Chris Dollin wrote:
ThaDoctor wrote:
>

pete skrev:

ThaDoctor wrote:

I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.
>
The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.
>
--
pete

And after this how do I run the program under linux ?
>
The same way you run any other program in Linux, which, if
you ran the compiler, you presumably already know.
How does it follow from running the compiler by invoking
"gcc hello.c" that one runs the program by typing "./a.out"?

umteenth_out_of_topic_post {

Because the compiler as a default will create an executable
with name a.out
But because it is a default, there is no reason to assume that
a new user would know that. If the syntax of the compiler forced
you to specify a destination file, such as "gcc hello.c a.out",
then it would follow that the user would know what the output
file is because he had to type it. When defaults are involved,
it does not follow that a user knows how to run the program
since he knew how to run the compiler.
(derived from "assembler output") in your
working directory. In Unix a single dot (.) is shorthand for
your working directory. So typing "./a.out" (without the quotes)
tells to the operating system to execute the file in the working
directory with name a.out
That wasn't what I was asking. I asked how does knowing how
to run the compiler without the leading "./" infer that one must
preceed a.out with "./"?
Of course such a file will be created
only if the compilation completed without poblems.

If dot (.) appears in your PATH variable then you can simply type
a.out If you didn't understand the last sentence you can safely
ignore it.
}

Christopher Benson-Manica wrote:
ThaDoctor <To*********@gmail.comwrote:
and after I have written and cmpiled how do I run the program under
linux ?
<ot>
Run a.out. man gcc for details, assuming that's your compiler.
Take further questions to comp.unix.programmer.
</ot>

I don't think that a beginner will get much out of the gcc man page.
Bill Pursell wrote:
ThaDoctor wrote:
pete skrev:
>
ThaDoctor wrote:
I would like to get started with programming in C,
but I cant get it to
work, I do not need any compiler or such.
Only a basic explanation of the first program Hello World that print
"Hello World" on the screen.

The whole point of the Hello World program,
is to gain enough familiarity with your C implementation
to write, translate, and execute a C program.
>
and after I have written and cmpiled how do I run the program under
linux ?
% gcc hello_world.c -o hi # compile the program
% ./hi # execute the program

There is a pitfall here in that if there's already a file with name
"hi",
then the compilation command will silently overwrite it.

Spiros Bousbouras
Jul 27 '06 #12
On 27 Jul 2006 10:29:04 -0700, "me********@aol.com" <me********@aol.com>
wrote:
>That wasn't what I was asking. I asked how does knowing how
to run the compiler without the leading "./" infer that one must
preceed a.out with "./"?
This isn't a compiler issue, it's a matter of whether the current
directory is in the PATH variable. When I want a program to execute
without the leading "./", I move it to /usr/local/bin.

Clifford Stern
ax***@lafn.org
Aug 1 '06 #13

Clifford Stern wrote:
On 27 Jul 2006 10:29:04 -0700, "me********@aol.com" <me********@aol.com>
wrote:
That wasn't what I was asking. I asked how does knowing how
to run the compiler without the leading "./" infer that one must
preceed a.out with "./"?

This isn't a compiler issue,
I didn't say it was.
it's a matter of whether the current
directory is in the PATH variable.
I didn't ask why it works the way it does.
When I want a program to execute
without the leading "./", I move it to /usr/local/bin.
No one asked what you want. The question was

"How does knowing how to run the compiler infer that
one knows how to run the program?"

Please try to keep up.
>
Clifford Stern
ax***@lafn.org
Aug 1 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1493
by: cara_little | last post by:
Good Morning, I'm trying to get started with the Enterprise Library to evaluate it and recommend to the rest of the developers in the company. However, I'm having a heck of a time getting started...
80
5182
by: Bibby | last post by:
Hi, I'm interested in getting started in the programming world. I've dabbled in C, C++ and VB6. Which would be the best language to focus my attention to regarding the following considerations: ...
0
1537
by: Peter Chant | last post by:
I hope no one minds me running this past them. I'm running a linux machine with with apache, php and mysql. This is not accessable from the internet. I want a server that is visable to the...
2
1152
by: tom c | last post by:
In asp.net 2.0 I found this great list of getting started walkthroughs that take you through what you need to know step by step. http://msdn2.microsoft.com/en-us/library/ms186109.aspx Now I...
4
1617
pntkiran
by: pntkiran | last post by:
i have on project in php. i want to run that project on linux machine. so to execute that project which steps required. is there any need to configure httpd.conf file if then tell me all...
1
1796
by: rocket1356 | last post by:
Anyone know what component or where to get a tutorial on how to connect to a LINUX machine using a VB app? I am trying to create a WIN32 Visual Basic application that communicates with a LINUX...
1
4717
by: =?Utf-8?B?Q29kZVNsaW5nZXI=?= | last post by:
I plan to build my own 2008 Server/Hyper-V system and will not be using one of the tested Dell or HP systems from the release notes and could use some pointers as to my assumnptions and answers to...
3
2164
Banfa
by: Banfa | last post by:
So the title pretty much says it. I am attempting to switch to Linux but the printer attached to my machine must still be accessible by my wife who uses Windows. Alternatively attaching the...
1
2141
by: tvnaidu | last post by:
I have Linux machine and windows machine on same network, I want to keep Linux machine as CVS server and windows machine as CVS client, can I keep like that?. My development machine is windows...
1
1772
by: James Wright | last post by:
Hi, I am using oracle9i on Windows XP for my work. I have seen that sometimes oracle services(either listner or instance, sometimes both) are not getting started automatically on rebooting the...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.