Welcome!
How can I compile c++ code with Pelles C compiler?
I did not compile the next code:
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
Can you help me?
Pelles C is an ANSI C compiler, if it would allow compiling C++, it would have been called Pelles C++ ;)
C and C++ are two different programming languages.
Thank you!
Yes of course, I know that c and c++ are different programming language!
How can I adjusted in Pelles ide that it compiled c++ code?
Thank your answer!
Quote from: baloghi on September 12, 2010, 12:19:58 PM
How can I adjusted in Pelles ide that it compiled c++ code?
There is no way to compile C++ with Pelles C, since C++ is not ANSI C.
You can only compile ANSI C with Pelles C for C++ you need to use a different compiler.
Thank you!
Quote from: Stefan Pendl on September 12, 2010, 12:45:28 PM
Quote from: baloghi on September 12, 2010, 12:19:58 PM
How can I adjusted in Pelles ide that it compiled c++ code?
There is no way to compile C++ with Pelles C, since C++ is not ANSI C.
You can only compile ANSI C with Pelles C for C++ you need to use a different compiler.
You
can't compile c++ with
POCCYou
can compile c++ with PellesC IDE using some tweaks ( obviously using a c++ compiler ).
How you set up to compile C++ programs depends on whether you are using Windows or Linux/Unix. This page describes the approach to use if you have a Windows machine. If you have a Linux/Unix machine, read this page instead.
There are many free C++ compilers that can be used with Windows. I am most familiar with Cygwin, available at http://cygwin.com. These instructions assume you plan to downloaded this compiler, but it applies to many other compilers with small detail changes.
Download Cygwin, which is a self-extracting compressed file. Execute the file, follow the provided instructions, and the program will install itself.
Once you have installed the program, you should be able to execute it from a DOS window. Open a DOS window and type g++ -v to establish that the program has been installed and can be executed.
When I compile I use a batch file named gccp.bat with this content:
@echo off
echo compiling C++ using -ansi -pedantic-errors -Wall
g++ -ansi -pedantic-errors -Wall %1 %2 %3
If you want this batch file, simply copy it from this page and save it on your system in a file named gccp.bat. The file shold be located in a directory that is part of your path satement.
This batch file sets up the most strict ANSI standard compliance level, making it necessary for the programmer to pay attention to many compatibility and style issues. There are even some incompatibilities within Cygwin's own library routines, so this batch file may not always result in a successful compile even if your program is flawless. But in general, it is a good idea to establish high standards as a student, to become accustomed to good programming style.
If the Cygwin compiler is executed directly, without using the batch file, its behavior is more relaxed. This may sometimes be necessary.
Set up a convenient data directory in which to place your programs. Create a file named temp.cpp with this content:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Again, you should be able to simply copy this little program from this page, and use a text editor to save it as temp.cpp.
Open a DOS window, change to the directory in which temp.cpp is located, and type this:
gccp temp.cpp
If you have not made any errors, the program will compile uneventfully, and a program file named a.exe will be created in the same directory.
Type a and press Enter. The program should run, and print Hello world! on the display.
This series of actions confirms that you have acquired a C++ compiler and it is working properly.
_____________________________________________________________
I have not removed the above replay to let you check it. Is it a piece of something copied and pasted here just to add an advertisement?
Of course I removed the advertisement that is not allowed by forum policy.
For C++ code are two good free IDE's available (possibly more): NetBeans from Sun/Oracle (a Java IDE with C++ extension) or Eclipse.
But they don't include compilers and tools. Even not Windows functions or libraries. They are based on GNU Cygwin32 or MSys/MinGW. But extensions for windows programming are available as additional libraries or widgets.
More info:
http://netbeans.org/
http://www.eclipselabs.org/p/wascana
Somebody offert a plugin to compile C++ with Pelles C IDE and the Micorsoft Visual C++ Toolkit 2003 (http://forum.pellesc.de/index.php?topic=482.0).
For MinGW GCC I would prefer one of this IDEs:
Code::Blocks http://www.codeblocks.org/ (http://www.codeblocks.org/)
CodeLite http://www.codelite.org/ (http://www.codelite.org/)