LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2009, 08:46 AM   #1
mq15
Member
 
Registered: Apr 2009
Location: Pakistan
Distribution: Linux Mint Cinnamon
Posts: 224

Rep: Reputation: 31
How to program in c/c++ in Linux


I know programming in c/c++ in Windows environment, but I know little about c/c++ programming in Linux,please help

Regards
 
Old 04-15-2009, 08:55 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
One slightly flip answer is that "Programming is Programming"---i.e. you have to set up an environment with libraries, header files, etc. + a compiler.

The standard Linux compiler is GCC, and may already be installed. Beyond that, what kinds of programs do you want to build? For example, if you want graphical apps, you will need something like the Qt or Gtk toolkits.

I recommended buying (and reading) Beginning Linux Programming, Matthew and Stones, published by Wrox
 
Old 04-15-2009, 09:52 AM   #3
mq15
Member
 
Registered: Apr 2009
Location: Pakistan
Distribution: Linux Mint Cinnamon
Posts: 224

Original Poster
Rep: Reputation: 31
thanks pixellany

I am going to implement my protocol. Now if I have GCC compiler already installed, I don't know how to use GCC for compilation, and after that I would also use some debugger. But I know nothing. Please be generous enough and explain me in sufficient details.
Regards.
 
Old 04-15-2009, 11:03 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by mq15 View Post
thanks pixellany

I am going to implement my protocol. Now if I have GCC compiler already installed, I don't know how to use GCC for compilation, and after that I would also use some debugger. But I know nothing. Please be generous enough and explain me in sufficient details.
Regards.
I don't know what you mean by "implement my protocol".

Do some Google searches on GCC---there are lots of manuals and tutorials out there. (And get the book I suggested.)
 
Old 04-15-2009, 01:06 PM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Code:
hyper> cat hello.c
#include "stdio.h"

main(int argc, char *argv[])
{
 printf(" hello world \n");
}
hyper> gcc -g hello.c -o hello.x
hyper> hello.x
 hello world
man gcc
man gdb


for more info

Last edited by schneidz; 04-15-2009 at 01:07 PM.
 
Old 04-16-2009, 03:56 PM   #6
mq15
Member
 
Registered: Apr 2009
Location: Pakistan
Distribution: Linux Mint Cinnamon
Posts: 224

Original Poster
Rep: Reputation: 31
Question

Thanks
When I type hyper> cat hello.c is:
hyper> cat hello.c
bash: hyper: command not found

Also I compiled hello.c as:
#gcc hello.c
this command created a.out file,now I dont know how to run this file or make any executible (i.e .exe) file.

Please help me.
 
Old 04-16-2009, 03:59 PM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
when compliling with gcc the default is a.out. you can do I think
Code:
gcc hello.c -o hello
and that should output your executable binary as hello. Or you can also type
Code:
mv a.out hello
and that will rename the a.out binary to what ever you specified it as.
 
Old 04-16-2009, 10:10 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by mq15 View Post
Thanks
When I type hyper> cat hello.c is:
hyper> cat hello.c
bash: hyper: command not found

Also I compiled hello.c as:
#gcc hello.c
this command created a.out file,now I dont know how to run this file or make any executible (i.e .exe) file.

Please help me.
What is "hyper" supposed to do? I can't find any reference to such a command......

Have you found a tutorial on compiling on Linux?

Have you gotten a book?--the one I recommended, or something else?

I did a Google search for you:
http://www.google.com/search?hl=en&r...al&btnG=Search
 
Old 04-16-2009, 11:53 PM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
hyper is the name of my machine (prompt).

you should learn other precompiled c programs (like ls, cd, mv) then you'll understand the basics of running programs then you can create your own.
 
Old 04-17-2009, 12:18 AM   #10
Maddy_linux
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Rep: Reputation: 0
hyper script or prompt?

Quote:
Originally Posted by schneidz View Post
hyper is the name of my machine (prompt).

you should learn other precompiled c programs (like ls, cd, mv) then you'll understand the basics of running programs then you can create your own.
Hi,

i am a newbie to linux, and was looking in the forums and came across this which i never heard of.

Can you please explain little more on that?
So, hyper is another folder as hyper and you have script files in that folder?

hyper is another file with the script in it and has the same name as your prompt?

or is it possible to program within ur prompt as per what you said? if so how do you access your prompt?


Thanks,
Maddy
 
Old 04-17-2009, 06:45 AM   #11
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
This thread has entered the "Twilight Zone".....

schneidz posted a code sample (cut and paste from a terminal). This included the prompt that appears in any terminal---in his case, simply the HOSTNAME of his computer. Mine looks like this:
Code:
root@Ath:~#
This says I am running as root on a computer named "Ath", and I am in my home directory. This prompt can be customized by editing the PS1 environment variable.

Then the OP misread the code and thought that "hyper" was a command.

To answer Maddy---the prompt appears in a terminal and is simply the "marker" inviting you to "enter commands here". You can find a terminal in your menus, or with ctrl-alt-F1.

If OP does not come back soon, we'll close this.......

Last edited by pixellany; 04-17-2009 at 06:46 AM.
 
1 members found this post helpful.
Old 04-18-2009, 01:13 AM   #12
Maddy_linux
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by pixellany View Post
This thread has entered the "Twilight Zone".....

schneidz posted a code sample (cut and paste from a terminal). This included the prompt that appears in any terminal---in his case, simply the HOSTNAME of his computer. Mine looks like this:
Code:
root@Ath:~#
This says I am running as root on a computer named "Ath", and I am in my home directory. This prompt can be customized by editing the PS1 environment variable.

Then the OP misread the code and thought that "hyper" was a command.

To answer Maddy---the prompt appears in a terminal and is simply the "marker" inviting you to "enter commands here". You can find a terminal in your menus, or with ctrl-alt-F1.

If OP does not come back soon, we'll close this.......
Hey thanks for the response i was confused by the previous thread when it is mentioned it can be programmed for the prompt. This answered my question and i agree

Thanks,
Maddy
 
Old 04-19-2009, 12:35 AM   #13
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i should explain, in college, one of the labs was to create your own 'ls' program and your own 'shell'. mine happened to have a non-standard prompt so that's why my screen grab looked the way it did.
 
Old 04-19-2009, 02:09 PM   #14
mq15
Member
 
Registered: Apr 2009
Location: Pakistan
Distribution: Linux Mint Cinnamon
Posts: 224

Original Poster
Rep: Reputation: 31
I would also like to learn editing the prompt but first I want to about one dedicated environment for compiling and debigging my .c/.cpp files in fedora. From discussion here, I have learnt compiling with gcc command but what I want is a seperate, specialized environment like Turboc++ and Borland I used in Windows Systems by Microsoft.

Regards
 
Old 04-19-2009, 02:13 PM   #15
mq15
Member
 
Registered: Apr 2009
Location: Pakistan
Distribution: Linux Mint Cinnamon
Posts: 224

Original Poster
Rep: Reputation: 31
Editing the prompt is also interesting but first I would like to know about a dedicated environment for compiling and debugging my .c/.cpp files in fedora like the one I used in Windows e.g TurbooC++ and the Borland.
I have learnt compiling using gcc command at terminal but I want some separate and specialized program.
Regards
 
  


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
sms program and database in linux web program in windows.. does not see each other.. keikun_naruchan Programming 0 07-06-2005 01:40 AM
Brand New to Linux, intermediate Programmer, want to program for linux destop apps albertrosa Programming 4 12-08-2003 07:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:30 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