ok this is one of the many things I don't trust google on. What is a good new compiler (C++ and D would be nice) for Linux? Kubuntu
PS Is the system() function universal as in it will do the same thinge in Linux Windows and OSX

Recommended Answers

All 9 Replies

What is a good new compiler (C++ and D would be nice) for Linux?

GCC is generally recommended for C++.

PS Is the system() function universal as in it will do the same thinge in Linux Windows and OSX

It's universal in that you can use it, but the argument to system() is inherently non-portable.

In Linux, it's all about GCC.

If you're using KDE (which you are if you have Kubuntu) then KDevelop is a pretty comprehensive development environment that uses GCC to compile. If you just get KDevelop from the package manager then it will sort out getting the compiler and all that for you :)

Ok the usual rules apply; where would I download this; I don't have Internet; All things for this will have to be downloaded on an other computer and move it to mine via Flash Drive; CD, Floppy Disk, Punch Card, typing the binary code into an assemble/bin file and tuning it into whatever the file extention for compilers are, ect.
I know man, I wish I had Internet it's like buying an xbox and barowing all the games from other People. I couldn't have Internet if I wanted ether there was a new hard drive issue and my network card is fried.

Ok the usual rules apply; where would I download this

It's probably already on your system. Try typing this into the command line:

gcc --version

I don't have Internet

If you don't have internet, I have two questions:

  1. How are you posting here?
  2. Why would it matter if we told you where to download gcc?

Ok, if you don't have the internet connection on the machine on which you want to install the compiler, then it is much more tedious to install software on Linux.

Many linux distros come with the compiler pre-installed, and I believe Kubuntu is one of them, you can first check if you have a C++ compiler by doing:

$ g++ -v

If you have internet, all you need to do is:

$ sudo apt-get install build-essential

If you don't have internet, you need to download the .deb files manually, and then install them. You can download the packages from here:
https://launchpad.net/ubuntu/natty/i386/build-essential/11.5ubuntu1
which is for Ubuntu/Kubuntu Natty (11.04) and towards a i386 architecture, for other versions or platforms, just change the names in the address (e.g. ../ubuntu/lucid/amd64/build-essential/11.4, you can search the launchpad.net webpage for "build-essential" for your platform).

Then, you cannot just download the top-level package (build-essential) because that is actually just a collection of packages and the .deb file does not include them, it simply lists them for the package manager to find and fetch from the package repositories. So, you need to look at the "Depends" section of the Launchpad website and download all the packages listed there, and then all the packages listed in the "Depends" section of those packages and so on, so forth.

To not have to download every dependency package, you can check on your Kubuntu machine if you have the given package by a simple command. For example, if you want to know if the gcc package is installed, just run:

$ dpkg -l | grep gcc

If the gcc package is not listed then it means you don't have it. It will also give a version number for the package (e.g. "4:4.5.2-1ubuntu3"), if that number does not correspond to the number on the launchpad website, then you do need to download the package too.

Once you have downloaded all the .deb files, put them all in one folder in your Kubuntu machine, then open a terminal, move to the folder in question, and run:

$ sudo dpkg -i -R ./

If that doesn't work (I have never done it myself), then you need to install all the packages you downloaded manually from the lowest-level ones to the upper-most one (e.g. build-essential). To install just one individual package, you do:

$ sudo dpkg -i gcc-4.5_4.5.2-8ubuntu4_i386.deb

(for many individual packages, you just list the .deb filenames as in the above command)

I guess you should understand by now that having an internet connection would save you a heck of a lot of trouble. It will take less than 15-30 minutes to install everything you could possibly need for C++ development in Kubuntu, you have an internet connection. However, I strongly believe that Kubuntu (at least, recent versions) come with both KDevelop and build-essential (because KDevelop is one of its most renowned applications).

Ok here are a few problems and answers:
The Internet thing: I post though my iPod. Reason for not having Internet: overly paranoid parents
The other computer is a Widows comp
I'm saving up for RAM (255 megs is what I currently have and Minecraft is so slow!) so don't want to buy a wireless card
Finally, how do I tell what kind of Linux I have I know it's ether lucid Linux or natty narwhal (Where do they get these names?)

>>how do I tell what kind of Linux I have?

You run (from a terminal, any folder):

$ cat /etc/lsb-release

Well, Kubuntu (as Ubuntu) is a Debian based distro and so, the GCC package should be shipped within the distro, you should try this anyway.

sudo apt-get install build-essential

This will install the GNU Compliller Collection and many other porgrams, libs and SDK needed to build in C, C++, python, perl and other Linux frineds.

Also keep this in mind (specially if coming out from Visual C++)

gcc --- if you build C apps

  • they don't use OOP or namespaces

g++ --- if you build C++ apps.

  • if you use OOP
  • namespaces
  • libs like: iostream, fstream, ncurses I think
  • or if you mix C and C++ (you can use malloc() and free and also new and delete in a
    convinient way to avoid memory lacks)

Well, I hope it helps

Ubuntu is good based on my personal experience and as you are using Code::Blocks on Windows it is good because Code::Blocks works well on Ubuntu too.
If you have problems running Hello World program may be you need to run this

sudo apt-get install build-essential
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.