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 12-29-2003, 09:34 AM   #1
gamehack
Member
 
Registered: Jun 2003
Location: Sevenoaks, UK
Distribution: Ubuntu
Posts: 183

Rep: Reputation: 30
Starting to program ;) Need a little help


Today a bought an book for C and C++ and I want to test the first programs they are very simple: Here is one of them
Code:
#include <stdio.h>

int main(void) {

int num = 100;
printf("The number is %d", num);

return 0;
 }
And I want to compile and execute it,but do not know how to do it I tried with the command:
Code:
gcc -x C myprogram.c
The book I read is about ANSI C and I think that the code should work on Linux too ?
Thanks to everyone
 
Old 12-29-2003, 09:45 AM   #2
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
Hi!

Try this:
gcc -o myprogram myprogram.c
and then run it with
./myprogram

The complete gcc manual is here:
http://www.gnu.org/software/gcc/onlinedocs/

Good luck with your programming!
Martin
 
  


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
Starting program with ./ AndyMCR Slackware 6 07-16-2005 05:57 PM
Starting to program in C snoopyswiss Programming 4 11-04-2004 09:38 PM
Starting a program with a given process id DropSig Linux - Newbie 1 09-29-2004 08:41 PM
Starting program on different screen aasenDK Linux - Newbie 1 05-30-2004 03:07 PM
Starting a program to a different console b52.net Linux - General 2 04-28-2004 01:28 AM

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

All times are GMT -5. The time now is 05:52 AM.

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