C++ Primer For Java Programmers Program Compilation<< Linked Lists | Table of Contents | Preprocessor Directives >>
Compiling and LinkingCreating an executable C++ program involves both compilation and linking. For simple programs consisting of a single source file, the compilation and linking can be combined with the following command (assuming the source file is in the current working directory) g++ -o mypgm mypgm.cc The (:note warn:) Be very careful using this command. It is not unusual to accidentally enter something similar to g++ -o mypgm.cc mypgm.cc instead of that specified above. If you make this mistake, there will be no warning and the compiler will create the executable named ExecutionIf you the program to be executed is in the current working directory, then simply enter the following, where ./mypgm
|