954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Best free C/C++ compiler for a newbie?

Ok, time to get off my ass and learn C and C++. However, I'm having a bit of trouble finding a free compiler; I'm a newbie so it needs to have a friendly and explanatory GUI if possible. Just post name and/or link, thanks :D

Cup of Squirrel
Junior Poster
133 posts since Oct 2004
Reputation Points: 11
Solved Threads: 1
 

Hello,

I would recommend Bloodshed Dev-C++ for C++ programming.

If you want to compile C code, I would suggest using a C compiler such as GCC. I'm un-aware of any free available IDE envrionments for the C language. Though you may be able to compile C code in Dev-C++. I've never tried, though.


- Stack Overflow

Stack Overflow
Junior Poster
193 posts since Sep 2004
Reputation Points: 26
Solved Threads: 4
 

>Though you may be able to compile C code in Dev-C++.
You can. You just need to be sure that the source file extension is .c instead of .cpp.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Ok, downloaded and found an online tutorial and I've already hit a bit of trouble:

// my first program in C++

#include <iostream.h>

int main ()
{
  cout << "Hello World!";
  return 0;
}


Thats the program. I compile and run as a .cpp. It seems to compile fine ("hello.exe" appears in folder), but when it comes to running, it shows the DOS box to display the text, and immediatly (spelling?) closes. The log displays something like this:

In file included from C:/Dev-Cpp/include/c++/3.3.1/backward/iostream.h:31,
                 from /my folder etc/hello.cpp:3:
C:/Dev-Cpp/include/c++/3.3.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.

Execution terminated
Compilation successful


What am I doing wrong :S

Cup of Squirrel
Junior Poster
133 posts since Oct 2004
Reputation Points: 11
Solved Threads: 1
 

Hello,

You may want to try:

// my first program in C++

#include <iostream>
using namespace std;

int main (void) {
	// Display text
	cout << "Hello World!" << endl;
	// Pause screen
	cin.get();
	// Terminate program
	return 0;
}


The function get() extracts a character from the stream and returns its value. It's a good way of pausing the console screen.


- Stack Overflow

Stack Overflow
Junior Poster
193 posts since Sep 2004
Reputation Points: 26
Solved Threads: 4
 

I've used Bloodshed too, very good for beginners.

If you like bells and whistles Microsofts EVT C++ is free from their site, It's designed to compile for programming mobile devices like smartphones or pocket PC's. I've done a couple of tools for my Pocket PC on it, it's a great toy !

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

Ah I was looking at programming for the Palm OS as I have a PalmOne Zire, so I might look into that :D

Cup of Squirrel
Junior Poster
133 posts since Oct 2004
Reputation Points: 11
Solved Threads: 1
 

Pelles C is free and comes with support for Pocket PC and Smartphones. It has a great IDE and helpfile!

Download it from:
http://smorgasbordet.com/pellesc/index.htm

vegaseat
DaniWeb's Hypocrite
Moderator
5,986 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

I've been following this thread and I also downloaded the Bloodshed compiler. Can you tell me where that online tutorial is?

murschech
Junior Poster in Training
60 posts since Dec 2004
Reputation Points: 21
Solved Threads: 1
 

I would also recommend DevC++, also DJGPP is useful if you want to program old VGA graphics.

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

Dev C++ is a good choice, I've used it when I needed a C compiler, it has GUI and its easy to use. But debugging isn't a piece of cake... at least for me.

Layla_2401
Newbie Poster
22 posts since Sep 2004
Reputation Points: 11
Solved Threads: 0
 

I use Turbo c++ 3.
It's not supposed to be a good thing, but no 'using namespace std;' declarations! You can get it free here . I wouldn't recommend Turbo c++ 1.0 because it isn't so good with c++ (or at least I found it so).

sinB
Newbie Poster
11 posts since Dec 2004
Reputation Points: 10
Solved Threads: 0
 

I would suggest dev-cpp(++) too. It can be a huge task finding all the libraries, and other things, so I would recommend it. ( I am a newbie myself, but I have had no problem with it)

vivosmith
Newbie Poster
19 posts since Mar 2010
Reputation Points: 37
Solved Threads: 0
 
WaltP
Posting Sage w/ dash of thyme
Moderator
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

Compilers Code::Blocks MSVC++ Express Open Watcom C++/Fortran Bloodshed DevC Turbo C++ Explorer 2006 Borland 5.5 cygwin

Pick one.


Compilers? No way WP ;)
They are IDEs and some of them bundles compilers
MINGW|MSVC Compiler|Open WATCOM|Digital Mars et al

I would suggest CodeLite or CodeBlocks. Simple and beautiful IDEs that can be used with MINGW (GCC) and MSVC as well as others

evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
 

Compilers? No way WP ;) They are IDEs and some of them bundles compilers MINGW|MSVC Compiler|Open WATCOM|Digital Mars et al

I would suggest CodeLite or CodeBlocks. Simple and beautiful IDEs that can be used with MINGW (GCC) and MSVC as well as others


If the IDE bundles a compiler, it can produce code. As far as most people are concerned, that is a compiler. Don't be so anal...

WaltP
Posting Sage w/ dash of thyme
Moderator
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

In order for your screen to pause, in Dev C++ go to tools, then select environment options & make sure that the option "Console Window Remains open" is selected.

If that doesn't solve your problem then it might be that you have spaces in your file names...

BrandonB
Light Poster
38 posts since Mar 2010
Reputation Points: 11
Solved Threads: 0
 

Ok, downloaded and found an online tutorial and I've already hit a bit of trouble:

// my first program in C++

#include <iostream.h>

int main ()
{
  cout << "Hello World!";
  return 0;
}

Thats the program. I compile and run as a .cpp. It seems to compile fine ("hello.exe" appears in folder), but when it comes to running, it shows the DOS box to display the text, and immediatly (spelling?) closes. The log displays something like this:

In file included from C:/Dev-Cpp/include/c++/3.3.1/backward/iostream.h:31,
                 from /my folder etc/hello.cpp:3:
C:/Dev-Cpp/include/c++/3.3.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.

Execution terminated
Compilation successful

What am I doing wrong :S

You must type the code as follows:

#include <iostream>
using namespace std;

int main()
{
       cout << "Hello World!";
       
       return 0;
}
BrandonB
Light Poster
38 posts since Mar 2010
Reputation Points: 11
Solved Threads: 0
 

Talking of IDEs recently I have been using Geany, which is less of an IDE and more of an extended editor.

However the reason I mention it is that (assuming you already have the compiler installed but I am using it on Linux so that is less of a problem than it might be on Windows) without having to create a project file it is able to compile and link 1 source file programs (it can also start a make session for larger projects).

If you happen to be just doing a little testing on small code snippets that is a very useful feature, you can have several files open and just switch to any one and compiler it as a separate program.


The only IDE that WaltP doesn't seem to have mentioned is Eclipse althopugh that is a little complex may be for a beginner and it has some features I find irritating (mainly its belief that it is a file system not an IDE).

Also isn't Bloodshed DevC++ a little bit unsupported now?

Banfa
Practically a Master Poster
600 posts since Mar 2010
Reputation Points: 486
Solved Threads: 92
 

Alright I got two parts to my reply. The first will be over the compilers that are free that I use. I personally like Code::Blocks. I haven't used it all that much yet, but I like it so far. I also use Visual C++ 2008 Express Edition, except that's more for someone interested in writing Windows code. I also used to use Dev-C++, it's basic, it's nice, but compared to the others, I don't like it all that much.

Second, your code issues.

// my first program in C++

#include <iostream.h>

int main ()
{
cout << "Hello World!";
return 0;
}

This is good code so far. The issue you get with it closing immediately can be solved by adding this line:

system("pause");

before your

return 0;


line of code. Basically to fix that your code would like as such:

#include <iostream>

using namespace std;

int main()
{
        cout << "Hello World!" << endl;

        system("pause");
        return 0;
}

Note: I added

<< endl;


so it would display the

system("pause")


text (which simply prints, "Press any key to continue...") on a new line. I hope my answers help you as you further yourself in C++ development.

Spartan-S63
Newbie Poster
15 posts since Mar 2010
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You