Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
General Linux programming questions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
d3c3it
l33t
l33t


Joined: 01 Mar 2003
Posts: 765
Location: Manchester, UK

PostPosted: Wed Apr 16, 2003 9:16 pm    Post subject: General Linux programming questions Reply with quote

Hi
i want to start programming in C and maybe some java again. I gave up before because i found it a real hassle under windows but now im in linux and it seems to make sense now. Ive made a couple of bash scripts but what i wanted to know is how do i go about compiling any of the source i make. im going to be using vi no doubt for programming but do i have to emerge anything? like with java would i have to emerge the sun jdk? and how would i go about compiling C/C++ files under linux? Ive got a learn java in 24days book so i assume you just use the same commands as is describe in the book? *the book is designed with use of the sun jdk or sdk, i get confused of which:)*
Thanks in advance to any replies
_________________
Some people go to counselling,
others use linux
Back to top
View user's profile Send private message
Fillzee
n00b
n00b


Joined: 20 Jul 2002
Posts: 47
Location: Starkvegas

PostPosted: Wed Apr 16, 2003 10:16 pm    Post subject: Reply with quote

Just follow the Gentoo Java Guide to get java setup properly. As for C... If you got gentoo installed you have everything you need for it.
Just 'gcc -o mycompiledprogram mysourcefile.c' and your in business.
Back to top
View user's profile Send private message
d3c3it
l33t
l33t


Joined: 01 Mar 2003
Posts: 765
Location: Manchester, UK

PostPosted: Wed Apr 16, 2003 11:09 pm    Post subject: Reply with quote

woot thanks i wasnt sure if it was something like make file.c or something thanks again
_________________
Some people go to counselling,
others use linux
Back to top
View user's profile Send private message
michaelb
l33t
l33t


Joined: 06 Jun 2002
Posts: 686
Location: Ann Arbor, MI

PostPosted: Thu Apr 17, 2003 8:19 pm    Post subject: Reply with quote

No, makefiles are a whole different ball of wax. If you want to start developing large scale C apps that other ppl will use, then you will need to learn about makefiles and all that, but for just teaching yourself C, the gcc is all you need.

For java coding you just need a working JDK. If you want to use the actual Sun products, as I do, you need to emerge one of the following:
Code:
# emerge sun-jdk
will install the precompiled version of Sun's J2SE development kit. Whereas
Code:
# emerge sun-j2sdk
will compile the same product locally. As I understand it, the sun-jdk package was compiled using gcc 2.95, so you may run into problems with things compiled with 3.2, so if you want to use the Sun products, it is generally advisable to go through the full compile process yourself. Whichever one you choose, you will need to download a file or two and agree to a license agreement from Sun. When you first run the emerge it will tell you where to get the file(s) you need. After installing, you need to make sure you have it set up properly using java-config --set-system-vm=<your JDK version> and you're good to go. The systax will be as simple as
Code:
$ javac ClassFoo.java
to compile, and then
Code:
java ClassFoo
to execute.
_________________
Behold, The power of SEARCH!
Back to top
View user's profile Send private message
d3c3it
l33t
l33t


Joined: 01 Mar 2003
Posts: 765
Location: Manchester, UK

PostPosted: Fri Apr 18, 2003 1:23 am    Post subject: Reply with quote

i think im going to go with the black... 1, in the howto guide but thanks again!
so im still abit fuzzy about this C stuff do i do
make foo foo.c ? or what Fillzee said? iam a complete newbie to C i was brought up on basic and *shudder* visual basic
_________________
Some people go to counselling,
others use linux
Back to top
View user's profile Send private message
count
Apprentice
Apprentice


Joined: 28 May 2002
Posts: 242
Location: Dalton, MA

PostPosted: Fri Apr 18, 2003 2:02 am    Post subject: Reply with quote

You do what Fillzee said, 'gcc -o foo foo.c' where foo is the compiled binary output and foo.c is your C source file.

The make command will look in the current directory for a file called 'Makefile'. This file contains rules on how to compile a program. Any commands you pass to make are interpreted as make targets (ie. what you want make to do, either to compile or install or whatever rules you defined in your Makefile). You should not worry about this yet, but as michaelb said, you will probably need to work with Makefiles if you start getting multiple source files or libraries.
_________________
- Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/
Back to top
View user's profile Send private message
d3c3it
l33t
l33t


Joined: 01 Mar 2003
Posts: 765
Location: Manchester, UK

PostPosted: Fri Apr 18, 2003 6:19 pm    Post subject: Reply with quote

right i get it now i just got java working so going to start messing with that
i know these are really simply questions but ive no idea on C at all
thanks for all your help
_________________
Some people go to counselling,
others use linux
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum