I have problem with compiling cpp that include another cpp files so I have Main.cpp Numbers.h and Numbers.cpp and it seems that TextMate only compile my Main.cpp and doesn't include the rest. I tried using xcode and it was working fine..
Here is the error from TextMate cmd+R:
Undefined symbols: "Numbers::Numbers(int)", referenced from: _main in ccMrD1Eq.o "Numbers::print()", referenced from: _main in ccMrD1Eq.o ld: symbol(s) not found collect2: ld returned 1 exit status
Any suggestion?
Btw, here is the invoked command:
#!/usr/bin/env ruby
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document"
mode = ENV["TM_SCOPE"].slice(/.*?\bsource\.((?:obj)?c(\+\+)?)/, 1)
case mode
when "c"
g = "GCC"
env = "C"
ext = "c"
lang = "c"
when "c++"
g = "GXX"
env = "CXX"
ext = "cc"
lang = "c++"
when "objc"
g = "GCC"
env = "OBJC"
ext = "m"
lang = "objective-c"
when "objc++"
g = "GXX"
env = "OBJCXX"
ext = "mm"
lang = "objective-c++"
end
TextMate.save_current_document(ext)
TextMate::Executor.make_project_master_current_document
flags = ENV["TM_#{env}_FLAGS"] || "-Wall -include stdio.h #{"-include iostream" unless mode[/c\+\+$/].nil?} #{"-framework Cocoa" unless mode[/^obj/].nil?}"
args = [ENV["TM_#{g}"] || g.downcase.gsub("x", "+"), flags + " -x #{lang}", ENV["TM_FILEPATH"]]
TextMate::Executor.run(args, :version_args => ["--version"], :version_regex => /\A([^\n]*) \(GCC\).*/m)
TextMate only does a simple compile of the .cpp file you're currently editing. Unlike Xcode or other full development environments it won't compile other source files in the project or perform linking.
(In TextMate click Bundles > Bundle Editor > Show Bundle Editor, then choose Run in the C section and you'll see exactly what TextMate is doing when you "Run" a .cpp file.)