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

run: driver.o
       CC -o run driver.o
driver.o: driver.cpp
       CC -c driver.cpp

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

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?

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

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:

CC = cc

run: driver.o
	CC -o run driver.o

driver.o: driver.cpp
	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.

This article has been dead for over six months. Start a new discussion instead.