# Rake and implicit dependencies

**URL:** <https://www.ruby-forum.com/t/rake-and-implicit-dependencies/110435>\
**Category:** Ruby\
**Created:** [July 26, 2007, 10:34am UTC](https://www.ruby-forum.com/t/rake-and-implicit-dependencies/110435 "2007-07-26T10:34:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpauly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecd19e/32.png) [@bpauly](https://www.ruby-forum.com/u/bpauly)\
**Post date:** [July 26, 2007, 10:34am UTC](https://www.ruby-forum.com/t/rake-and-implicit-dependencies/110435/1 "2007-07-26T10:34:04Z")

</div>

I am playing with Rake to build c projects and I run into this problem

#########  
task :default =\> [‘main.out’]

file ‘main.out’

rule ‘.out’ =\> [’.o’] do |t|  
sh “cc #{t.source} -o #{t.name}”  
end

rule ‘.o’ =\> [’.c’] do |t|  
sh “cc #{t.source} -c -o #{t.name}”  
end  
#########

fails with the error

in /home/phelan/ruby/rake)  
cc main.o -o main.out  
cc: main.o: No such file or directory  
cc: no input files  
rake aborted!  
Command failed with status (1): [cc main.o -o main.out…]  
/home/phelan/ruby/rake/rakefile.rb:6  
(See full trace by running task with --trace)

but the following works fine

task :default =\> [‘main.out’]

# file ‘main.out’

rule ‘.out’ =\> [’.o’] do |t|  
sh “cc #{t.source} -o #{t.name}”  
end

rule ‘.o’ =\> [’.c’] do |t|  
sh “cc #{t.source} -c -o #{t.name}”  
end

Where is the subtlety that I am missing here?
