LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-15-2004, 07:03 AM   #1
wozzle
LQ Newbie
 
Registered: Mar 2004
Posts: 11

Rep: Reputation: 0
Question Writing/Compling C programs in suse 9.0


Hi,
Im a newbie to the linux world, Ive recently installed suse 9.0.

I'm trying to write and complile c, but not getting far at all?

What is the best way to do this?

Cheers,

Warren
 
Old 03-15-2004, 07:12 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
do this file, call it "wozzle.c"

Code:
#include <stdio.h>

int main(void)
{
     printf("Hello Wozzle\n");
}
then do

Code:
make wozzle
and you will have a program called wozzle


billy
 
Old 03-15-2004, 07:43 AM   #3
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
Whhhhhhaaaatttt???
make only works if you create a makefile, bigearsbilly.
to compile wozzle.c type:

Code:
gcc -o wozzle wozzle.c
 
Old 03-15-2004, 08:06 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Since when?
you do NOT need a makefile to run make.

observe:
Code:
/export/home/billym
billym.primadtpuat>mkdir test
billym.primadtpuat>cd test
billym.primadtpuat>make test
make: *** No rule to make target `test'.  Stop.
billym.primadtpuat>touch test.c
billym.primadtpuat>make test
cc     test.c   -o test
make: cc: Command not found
make: *** [test] Error 127
billym.primadtpuat>export CC=gcc
billym.primadtpuat>make test
gcc     test.c   -o test
Undefined                       first referenced
 symbol                             in file
main                                /export/home/billym/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/crt1.o
ld: fatal: Symbol referencing errors. No output written to test
make: *** [test] Error 1
why don't you try it?

billy
 
Old 03-15-2004, 08:15 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Just to prove it:

Code:
billym.primadtpuat> print "#include <stdio.h>\nmain()\n{\nputs(\"hello wozzle\");\n}" > wozzle.c;make wozzle;wozzle
gcc     wozzle.c   -o wozzle
hello wozzle

billy
 
Old 03-15-2004, 08:36 AM   #6
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
It is way to early in the morning for me

Youre correct bigearsbilly, you caught me with my foot in my mouth.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Useful Programs In C InvisibleSniper Programming 6 10-13-2005 11:50 PM
Writing C programs! SpiderIRE Linux - Software 3 05-10-2005 05:25 PM
What programs for dvd writing/copying? barrys Linux - Software 2 01-30-2004 04:46 AM
Writing Programs in Linux? Volcom Programming 4 11-21-2003 08:31 AM
writing programs to run on 2 or more boxes nakkaya Programming 1 04-04-2003 11:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration