Advertising (This ad goes away for registered users. You can Login or Register)

Compiler and Linux please

Programming on your favorite platform, for your favorite platform? Post here
Post Reply
Howto
Banned
Posts: 70
Joined: Thu May 12, 2011 12:03 pm

Compiler and Linux please

Post by Howto » Fri Apr 20, 2012 9:33 am

Okay so i need a good C++ and a good linux. what do you suggest for me?
Advertising

User avatar
Xian Nox
Retired Mod
Posts: 2749
Joined: Fri Nov 05, 2010 5:27 pm
Location: Over the hills and far away

Re: Compiler and Linux please

Post by Xian Nox » Fri Apr 20, 2012 10:19 am

For a compiler, I'd recommend the gcc. It comes with most Linux distributions anyway.
As for a distribution, it all depends on your likes and dislikes. I use openSUSE because I started with it, and it's newb-friendly as well, and differences between distributions are pretty much just the configuration utilities and desktop environments, so it's a matter of taste mostly imho.
Advertising

Howto
Banned
Posts: 70
Joined: Thu May 12, 2011 12:03 pm

Re: Compiler and Linux please

Post by Howto » Fri Apr 20, 2012 10:51 am

i have another one big question that was bothering me for so long time.
I see M0skit0 writting in topics commands in bash and terminals. how they learned those commands and how can i learn those commands too?
(a little bit off topic but i skip the creation of another topic ;) )

User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Compiler and Linux please

Post by m0skit0 » Fri Apr 20, 2012 12:26 pm

You're new to Linux, so I strongly suggest Ubuntu or Mint. For an excellent C++ compiler, I agree with Xian Nox of course. When you install your distro, install build-essential package and you're good to go.
Howto wrote:how they learned those commands and how can i learn those commands too?
Practice :mrgreen: Well usually you learn those commands when you need them. You can find plenty of tutorials on the net anyway. You'll find that the Linux community is very friendly and helpful ;)
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

debragon
Posts: 1
Joined: Tue Jun 05, 2012 12:41 pm

Re: Compiler and Linux please

Post by debragon » Tue Jun 05, 2012 12:45 pm

Yeah, you may start with the official Linux community.

ks177
Posts: 4
Joined: Thu Oct 18, 2012 5:29 pm

Re: Compiler and Linux please

Post by ks177 » Sat Jan 05, 2013 6:42 pm

You may have read this before, but I suggest you skim through it again as the code examples in the book are often demo versions of basic unix utilities. (The book is actually much easier to understand if you are using linux rather than windows since the book is wrtten in the context of unix systems.). There is a chapter about unix specifically which is well worth reading.

http://www.google.co.uk/url?sa=t&rct=j& ... 4169,d.d2k

Actually I wouldn't consider bash to be off topic. You need to be familiar with it in order to program for linux.

Look at it like this:

In the old days, when you turned on your pc it loaded an operating system called dos. You were presented with a comand line which you could use to navigate and manipulate the file system, load programs and so on. One program you run was windows, which is a gui that sits on top of dos and allows a graphical environment which you could use instead of command line programs.

When you use linux, you essentially doing the same thing - you first load a command line environment and then on top of that you load a gui. There are various differant guis - gnome, kde and xfce for example which offer differant features or performance features. Any linux program with a gui can run in any of these guis. Linux programs can be command line based, command line based with a gui, or gui only.

What you shoud be aware of is that linux is a modular system. You can make a new program by combining command line programs. For example, you could wirte a bash script that check if the computer is connected to a specific network, and if no back up has been run that day, to automatically start running a backup, display a message to the user the user that the backup has started and another when it has finished. You can do all this by writing a script which runs command line programs, and it won't be a particulalr long program either.

Thus, when you program for linux, you can also make use of these modular componants rather than remaking the wheel, so it is important that you are familiar with them.

Here is a list of basic commands.

Note linux is case sensitive.

http://www.pixelbeat.org/cmdline.html

to log in as root - open a terminal and type in sudo passwd - enter you normal password and then enter a new root password. Then enter su and enter the root password. The most common commands ( assuming you using a debian based system like ubuntu) are:

sudo - run a command as if you were the root owner - has to be configiured to give you permissions
su -login as user - if no user is given login as root
cp - copy
rm -delete
cd - followed by director name - change diectory
mv - move or rename
grep - look for a givin string
ls - list
find - find ;)
locate - finds files use updatedb to update it.
nano - text editor
killall - kills a program
xkill - click ona program to kill it
apt-get - install/remove programs - eg apt-get install synaptic
synaptic - gui package manager
gparted - gui partition manager
df - display disk usage
dir - list directory contents
ifconfig - network manager
iwconfig - wireless network
iwlist - wifi manager
chown - change user ownership of targer - eg chown root:root example.file changes user root and group root to own example.file
chmod - change file permissions
cat display file contents
mount and umonunt - mount drives

If you open a terminal and type the command followed by --help it will show you what options you can use. If type man folliwe by the command it should open a manual page for it. If you use this symbol | you can let one command work with the output of a previous command. For instance if you type ls /etc, you will get a list of all the files in the /etc directory. If you use ls /etc | grep gnome , grep will look at the output of ls /etc and if anthing contains the string gnome it will be displayed. You can combine any number of commands like this. Similaly you send the output of a command to a file with > eg dir > targetfile will append targetfile with the the outpput of the dir command. You can download command line programs that do virtually evrything and you can use the all in your scripts - have look in synaptic.

Here is a more comprehensive guide:

http://tldp.org/LDP/abs/html/#

With linux you need to aware of directory strucure:-

http://www.tuxfiles.org/linuxhelp/linuxdir.html

And permissions:

https://www.linux.com/learn/tutorials/3 ... ermissions

So far as compilers go - again the system is modular. Unlike visual studio, you need a command line compiler and a seperate ide. gcc is the c compier and g++ the c++ compiler. For ides I like using eclipse but I use that for java (at the moment I use java for the gui and c++/c/assembly language at the command lin level to do the hard work. Netbeans is also good. You will need to be familiar wth a number of libraries such qt and gtk

https://www.eclipse.org/resources/resource.php?id=530

http://en.wikipedia.org/wiki/Qt_%28framework%29
http://www.gtk.org/

. A lot of linux stuff is actually done is c and glib rather than c++.

https://en.wikipedia.org/wiki/GLib
http://developer.gnome.org/glib/2.34/

Whereas you can get a devolpment sytem for widows, because of its modular nature, linux is a devolpment system - you can make you of these modules in your programs. If you can write a quick script that does a few things rather a load of cutom code, then do it. It may be a bit intimidating at first, but it get through that stage you shoul find it a pleasure to program for linux. After a while you look at windows and it just looks like a mess, you wonder why on earth they have made it like they have. Good luck! ;)

Post Reply

Return to “Programming”