Robert Linnemann wrote:

> I have been using microshaft Visual C++ for my C++ class, but it
> sucks, big time. I really want to use linux, and I know a small deal
> about it, but I can't get a program to become an executable. I have
> tried before doing
> 
> g++ source.cc
> 
> and it would work, but then I would get an "a.out" file, which I
> believe to be an object file.

a.out is an executable. Typing `./a.out' will execute it.

To specify a filename, use `-o', e.g. `g++ source.cc -o myprog'.

> I also get this error in emacs when trying to compile code by choosing
> compile from the menu. It then prompts me with make -k and I press
> return, then it gives me:
> 
> cd ~/code/
> make -k
> make: *** No Targets. Stop.

To compile a program using make, you generally need a Makefile.

It's possible to do without one if your program consists of a single
file, e.g. `make -k source' will look for a file called
source.<something> and then use the default rule for the extension.

For a .cc file, it would use `g++ source.cc -o source'. More
precisely, it would use

        $(CXX) -o source $(CPPFLAGS) $(CXXFLAGS) source.cc

where CXX defaults to `g++', and CPPFLAGS and CXXFLAGS default to
nothing.

For more details, see the `make' info file (`C-h C-i make').

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to