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

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

>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.

commented: Thanks for the info. -Stack Overflow +1

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

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

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 !

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

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

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

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.

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).

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)

commented: bump five year old dead thread. +27

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...

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...

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;
}

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?

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.

Well i honestly think that Code Blocks is the most kickass program honestly .

i second that.

As much as I know about routing Packets around the world for 15years, I'm also Curious
here in 2010 the Age of the Cloud/Voip/Elastic Computing, what I should of learned 15years ago.

Being 2010, Request FAST TRAK Small Footprint,simple to install,C++ Compiler
that might have the Infamous HELLO WORLD Basic Code Sample.

Trying to build a few usefull task bark notifciation scripts, and a little code
could take me a long way Fast.

I HAD VB, I Loved Xbase,FoxPro,Sql,Php,MySql...
so along the lines of Small & Tight and not require 700mg of USELESS Microsoft
Code to run a 500k app would be Nice.

Muchas Gracias,...!!!
THanks a bundle of Packets 0001110

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

Well i honestly think that Code Blocks is the most kickass program honestly .

Nothing is bad about C::B. I used it for long time and enjoyed. When I tasted CodeLite, I got lost to its world. Try it and tell me :)

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...

For what it's worth, I've always found it a source of confusion when people use IDE and compiler interchangeably. It's an impractical distinction to experienced developers, but it is an important one for newbies (who are likely to be interested in this thread).

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.