(Beginner) C++ Compilation?
I am both a new Linux user and a C++ pogrammer. The tutorial I am reading suggests I use Emacs to compile my programs, if that is what I have. So, I have gotten far enough to have a .cpp file that I made w/ Qt Designer, but when I hit compile in the Emacs, it tells me:
Quote:
I would appreciate some help. |
Not that way
Make is for when you have a Makefile, which you don't. To compile in c++ use g++.
Ignacio |
Make is only when you have a project with makefile
rather a simple c++ file just go g++ filename.cpp |
All right, this seems to have created "a.out". From there, I am to link it, right? What can I do for that?
|
a.out is the compilers default executable name.
To run the program type the following: ./a.out To create an executable with the name of your choosing: g++ -o app_name source.cpp app_name will be the name of your program. |
Hey, that helps a lot. Thank you very much.
Also, while I am at really humilliating questions, what do I do to run an executable file, that I have created. Is there a terminal command, or an easier way. Clicking at it doesnt seem to do much good. I read that 'Linuxprog' should do it, but it doesnt seem to be Fedora Core 2. |
I might also add that ./ is a shortcut for current working directory. Unlike windows, linux only searches the path environment for a command. You can add a directory to the path via your .bash_profile file (assuming your using bash).
|
What can I do to run this new file, on Fedora Core 2?
|
Quote:
|
Great! Thank you.
|
michaelk
Senior Member Registered: Aug 2002 Location: Distribution: Posts: 3485 HCL Entries: 0 Reviews: 0 ( post #5) a.out is the compilers default executable name. To run the program type the following: ./a.out To create an executable with the name of your choosing: g++ -o app_name source.cpp app_name will be the name of your program. I have a small doubt, won't this executable you are talking about now, need the installation of gcc in the system running this executable........ if(question is answered) { cout<<" thanks!!!!" } else { cout<<"Maybe you are fed up with such questions" } a newbie has many stupid doubts, so please do bear and answer, who knows these newbies may turn out to be goslings in future |
Nope
1. gcc is just the compiler, so they won't need it
2. It depends on what libraries you used. If only #include s, then they won't need anything. By the way, I still haven't managed to switch to cout, so I keep using good old printf :P |
All times are GMT -5. The time now is 07:05 PM. |