0

我是 NaCl 的新手。我试图按照提供的说明构建和运行示例代码https://developer.chrome.com/native-client/devguide/tutorial/tutorial-part1

我能够运行原始代码。现在在这个例子中,我创建了一个 .cc 和 .h 文件,并从 hello_tutorial.cc 中调用了一个新的 .cc 文件中的函数(这个文件已经存在)。但是我不确定如何在 Makefile 中添加这个新文件,以便在我运行 make 命令时编译器也会包含这些文件。

任何人都可以帮助我在这里缺少什么吗?

4

1 回答 1

1

The Makefile for part1 of the tutorial is hand rolled so you need to add a couple of new lines for each source file:

[new_file].bc: [new_file].cc
$(PNACL_CXX) -o $@ $< -O2 $(CXXFLAGS) $(LDFLAGS)

And then add .bc to the dependencies of the pexe:

hello_tutorial.pexe: hello_tutorial.bc [new_file.bc]

If you switch to part2 of the tuturial it uses the NaCl SDK build system which makes things a little easier and you just need to add your source to the "SOURCES =" line in the Makefile.

于 2014-09-11T17:19:22.400 回答