LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-08-2006, 03:09 PM   #1
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Rep: Reputation: 51
Very novice question


Hi everyone

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?

Any help appreciated.

Bob
 
Old 02-08-2006, 03:24 PM   #2
rshaw
Senior Member
 
Registered: Apr 2001
Location: Perry, Iowa
Distribution: Mepis , Debian
Posts: 2,694

Rep: Reputation: 45
you don't really need 'make' to run them locally. do they run as ./yourfilename from the terminal?
 
Old 02-08-2006, 03:30 PM   #3
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Original Poster
Rep: Reputation: 51
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.

Bob
 
Old 02-08-2006, 04:24 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
An error line
Code:
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.
 
Old 02-09-2006, 03:29 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
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)
 
Old 02-09-2006, 03:40 PM   #6
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Original Poster
Rep: Reputation: 51
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.

Thanks again

Bob
 
Old 02-09-2006, 10:07 PM   #7
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
look in the build menu and try the option 'run automake and friends' and see if you can build after that..
 
Old 02-10-2006, 02:59 AM   #8
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I am novice: which book should I read? jsmith6 Slackware 9 02-07-2006 11:04 AM
I'm a Novice danbinful Mandriva 4 04-14-2005 07:23 PM
Novice question about desktop jolphil Mandriva 3 01-24-2005 12:22 PM
Novice questions. linux_faq Linux - Software 2 05-14-2004 02:40 PM
Mostly Novice distro question gvaught Linux - Newbie 1 10-22-2003 09:52 PM


All times are GMT -5. The time now is 09:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration