Monday, July 27, 2009

How to create projects in c and c++ and what is a source code?

You may use any editor (VI, notepad, Visual Studio Express, Programmer's Editor, ...) to create source files (c/C++ files containing instructions to be compiled).


Depending on the language of choice (C and C++ are different languages) name your file accordingly (c for the C Language, cpp, C, c++ or cxx for C++).


Then compile, link (generally compilers do both things with a single command, you may use GCC for any platform, or Visual C++ Express from Microsoft for Windows -which is much easier to use) and run (just type the name of the program at the command line).





Sample. Write:





#include %26lt;stdio.h%26gt;


int Main(int argc, char* argv[])


{


puts("Hello World!");


return 0;


}





then save as "hello.cpp",





any platform: compile with "gcc hello.cpp -ohello" and type "hello"


Windows: if using MS Visual C++ Express, then just press F5

How to create projects in c and c++ and what is a source code?
Good answer there. Vote for it!


No comments:

Post a Comment