943,621 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1348
  • C++ RSS
Apr 8th, 2009
0

the most simple makefile ever

Expand Post »
hi, this is embarrassing, for whatever reason I am getting "Don't know how to make target driver.o" whenever i type make. There is only one file named "driver.cpp" in the directory that i have to compile. I am staring at tutorials and don't understand why this won't work.

heres whats in the make file
C++ Syntax (Toggle Plain Text)
  1. run: driver.o
  2. CC -o run driver.o
  3. driver.o: driver.cpp
  4. CC -c driver.cpp
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kyosuke0 is offline Offline
20 posts
since Sep 2008
Apr 9th, 2009
0

Re: the most simple makefile ever

You do realize that you cannot use spaces. You must use tabs.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Apr 9th, 2009
0

Re: the most simple makefile ever

Click to Expand / Collapse  Quote originally posted by nucleon ...
You do realize that you cannot use spaces. You must use tabs.


yes, but you cannot use the tab key in the forum message box so i used spaces to simulate the tab. The actual make file has tabs and the newline so i know those are not the problem, also I am using sun's c++ CC compiler in linux. sorry for the confusion
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kyosuke0 is offline Offline
20 posts
since Sep 2008
Apr 9th, 2009
0

Re: the most simple makefile ever

Does this line work if you type it into a console in the proper directory?

CC -c driver.cpp

When I used unix I only used C. Is CC (as opposed to cc) the C++ compiler?
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Apr 9th, 2009
0

Re: the most simple makefile ever

Click to Expand / Collapse  Quote originally posted by nucleon ...
Does this line work if you type it into a console in the proper directory?

CC -c driver.cpp

When I used unix I only used C. Is CC (as opposed to cc) the C++ compiler?

yes if i compile the file manually it produces an executable, and yes to your second question as well, the sun studio 12 suite i believe its called
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kyosuke0 is offline Offline
20 posts
since Sep 2008
Apr 9th, 2009
0

Re: the most simple makefile ever

I don't currently have access to Solaris ATM... alas, but perhaps it is something as simple as needing a blank line after each target:
C++ Syntax (Toggle Plain Text)
  1. CC = cc
  2.  
  3. run: driver.o
  4. CC -o run driver.o
  5.  
  6. driver.o: driver.cpp
  7. CC -c driver.cpp
BTW, you can have tabs in the forum message boxes, but you have to cut and paste them in... (So you can just cut and paste this code block into a file and it would work.)

The CC is a makefile macro. Sun's compiler is "cc". (I think...)

Hope this helps.
Last edited by Duoas; Apr 9th, 2009 at 1:15 pm.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: question about judge the puctuations
Next Thread in C++ Forum Timeline: Help with Classes and Doubly Linked Lists





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC