在MAC上,我可以使用命令行成功编译c ++程序
g++ *.cpp *.h -o executablename
Run Code Online (Sandbox Code Playgroud)
但是它在Sublime 2中失败了 - 我为此创建了一个构建系统
{
"cmd" : ["g++", "*.cpp", "*.h", "-o", "executablename"]
}
Run Code Online (Sandbox Code Playgroud)
有了这些结果
i686-apple-darwin11-llvm-g++-4.2: *.cpp: No such file or directory
i686-apple-darwin11-llvm-g++-4.2: *.h: No such file or directory
i686-apple-darwin11-llvm-g++-4.2: no input files
[Finished in 0.0s with exit code 1]
Run Code Online (Sandbox Code Playgroud)
但是,如果我在项目中创建具有特定文件名的构建系统,它可以工作:
{
"cmd" : ["g++", "Test.cpp", "TestCode.cpp", "TestCode.h", "TestCode2.cpp", "TestCode2.h", "-o", "executablename"]
}
Run Code Online (Sandbox Code Playgroud)
如何在Sublime 2中创建一个构建系统,它使用命令行模式在命令行上编译多个文件?
在这个例子中,我如何$containerObj从对象中的getContainerID()方法访问对象中的属性$containerObj->bar,或者至少获取指向$containerObj?的指针?
class Foo {
public $id = 123;
}
class Bar {
function getContainerID() {
... //**From here how can I can access the property in the container class Foo?**
}
}
$containerObj = new Foo();
$containerObj->bar = new Bar();
echo $containerObj->bar->getContainerID();
Run Code Online (Sandbox Code Playgroud)