Most C++ compilers-including g++ and nearly all others that run on Ubuntu-will examine the suffix of your input files to figure out how to treat them. c means C source code, not C++, and even when you run a C++-specific compiler command like g++, it will be treated as C. You should usually do that.Īlso, if your C++ source code file is not named with a name that ends in. With most compilers, including g++, this file is called a.out unless you have passed a different output filename by passing -o filename as command-line arguments to the compiler. You need to run the file produced by your compiler, which is a separate file. In this case, the specific error messages reveal that you are attempting to run your own C++ source code file. If you try to run what you think is a program produced by your compiler, and you get an error about permissions, this usually means you are running the wrong file. If you are able to successfully mark a file as executable with chmod +x-which you were-then your compiler will be able to do the same thing. When a compiler produces a binary file that is intended to be executed-that is, when it produces your program-it will automatically mark it executable. It is rarely useful to run chmod on a file you think your compiler has produced.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |