Public Group

# C++ Compilers?

This topic is 4300 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! Which is the easiest C++ compiler for beginners? I have tried Visual Studio but it was too hard. I tried Borlands compiler (but it didnt like me and I didnt like it ;)) I have also tried Dev-C++ which i kind of like. Is there any better/easier compilers for beginners? Thanks/ Robin

##### Share on other sites
All compilers are equivalent. You can then choose to use an IDE (Visual Studio, Code::Blocks, a correctly configured emacs) or a simple text editor (unconfigured emacs, vi, notepad, crimson editor).

The simplest I found was command-line g++ : run g++ *.cpp and your program is compiled as a.out, which you can then run.

##### Share on other sites
ok...I have had problems with different compilers though (they dont handle the code in the same way. This worked in Visual Studio:

#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}

While I had to write like this in Dev-C++:

#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!" << endl;
return 0;
cin.get();
}

And in Borland C++ Compiler, neither of these two worked.

##### Share on other sites
Quote:
 Original post by RobinOfSwedenok...I have had problems with different compilers though (they dont handle the code in the same way.

They should. If they don't, check if you are using them properly, and then contact the compiler distributors to notify them of the discrepancy. The example you gave for Visual Studio is correct, and should work on all standard-respecting C++ compilers.

##### Share on other sites
Ok...I really wanna learn to use Visual Studio. I know where to write the code etc. but I dont know what type of projects Im supposed to create (theres tons of em). I also dont know how to compile the program and test it (without actually doing a complete build). Do you know where to learn this? (I hate the Help Documentation).

Thanks/ Robin

##### Share on other sites
I just want to say that you shouldn't write any commands after the return statement:
#include <iostream>using namespace std;int main(){cout << "Hello, World!" << endl;cin.get();return 0;}

##### Share on other sites
Oh....just wrote wrong in the message... I wrote it correctly in the compiler though (before the return statement as you said...)

Thanks/

##### Share on other sites
If you're just starting with C++, 99% of Visula Studio's features you can totally ignore for now. All you need to do is always create a "Win32 Console Project". Add source files by using "Project->Add New Item" and choosing .cpp or .h. Compile your code with "Build->Build Solution". And run it with "Debug->Start Without Debugging".

When you are comfortable with this (and with C++), you can learn the other features, like using the debugger and creating graphical apps.

Hope that simplifies things for you.

##### Share on other sites
Thanks!

Really apppreaciate the help :)

One more thing...when creating a Console Application. What does the #include "stdafx.h" command do (the stdafx.h seems to be required, but what is it for)?

/Robin

##### Share on other sites
Oops, that's my bad, I forgot one important step. Be sure to check the "Empty Project" box when creating a new project. This tells the IDE that you don't want it to setup its little framework for you.

In case you're curuious, I believe the stdafx.h file is for precompiled headers, though I have never used this feature.

1. 1
Rutin
25
2. 2
JoeJ
20
3. 3
4. 4
5. 5

• 9
• 9
• 46
• 41
• 23
• ### Forum Statistics

• Total Topics
631750
• Total Posts
3002055
×