ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am in the very beginnings of teaching myself to program in C++. I have tried to use a graphical editor/compilor called Geanie. When I compile my practice programs everythings seems to go fine. However, when I attempt to build with "make" I get an error:
error: no target for "make all" unsuccessful build
I know to most of you this is an irratatingly simple question, but as I am trying to do this simply from books, these little nagging things hold me back. Would someone be kind enough to explain this error to me and tell me how to avoid it and build the practice programs so that they are executable?
Yes, they do. I am able to output the practice programs fine. I suppose I am trying to learn to use the graphical compilers (like KDevelop) as well as the language itself. I also want to be able to run them by just typing in the filename without ./myfile. I was able to do this once in Eclipse, but can't really remember how I did it.
Thank you for your response. Any extra help from experienced programers is appreciated.
if you have a simple C/C++ program,
simply typing make hello will compile and link as you would expect.
When you are making, I take it it's in a GUI. Obviously this is simply
calling make all and expecting a makefile.
Here's a simple makefile that should work for you. (assuming you have makedepend installed)
Put it in the project directory and call it "Makefile".
If you cut and paste and the makefile has errors, it may be because the indented lines
MUST be indented with TAB characters. This is essential.
# Standard makefile for standalone
# C files (not multifile projects)
# e.g. makes 'func.c' with:
# cc -c func.c -o func.o
# cc func.o -o func
# end up with 'func'
# using the built-in rules for
# simple single source programs
# recursive make, creates the includes first
# then does the targets
# first call cannot find the include files
# so they are made as targets, then all
# target invokes make again
makedepend -f $@ *.c
echo CFILES = *.c > $@
Thank you very much for the help...I have copied this and made note of your instructions. I need more study to properly use this information, but you have helped a lot. Learning this on my own with no classroom or instructor training is a little more difficult than I thought.