ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
error: no target for "make all" unsuccessful build
can have many reasons. It'd be a good idea to look into the Makefile. My guess is that it was generated to run the normal build not by using simple 'make', but make with a parameter.
if you have a simple C/C++ program,
e.g: "hello.c"
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.
Code:
# ---------------------------------
# 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
# --------------------------
INCLUDEFILE=files.mk
DEPENDFILE=depend.mk
TARGETS=$(CFILES:.c=)
all:
$(MAKE) $(TARGETS)
rm $(INCLUDEFILE)
rm $(DEPENDFILE)
$(DEPENDFILE):
touch $@
makedepend -f $@ *.c
$(INCLUDEFILE):
echo CFILES = *.c > $@
include $(INCLUDEFILE)
include $(DEPENDFILE)
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.
no probs bob.
it's not difficult, there's just a lot to learn and you can only
assimilate at a certain rate. You'll get there, just be patient!
make is a particularly arcane tool. very useful and powerful but also
incredibly, infuriatingly, confusingly annoying at times.
It took me quite a while to get my head round it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.