问候,
这是我的SConstruct文件:
env = Environment() env.Append(CCFLAGS=['-g','-pg']) env.Program(target='program1',source= ['program1.c'])
这里还有编译的输出:
scons: Reading sconscript files ... scons: done reading sconscript files. scons: Building targets ... gcc -o program1.o -c -g -pg program1.c gcc -o program1 program1.o scons: done building targets.
如您所见,我将“-pg”选项传递给构建环境.在我构建之后,我运行程序来生成“gmon.out”但它没有生成.
谁能证实这个问题?还是有解决方案?
谢谢.
更新:
感谢此处给出的建议,更新的工作SConstruct文件如下所示.链接器需要标志,因此要通过scons传递它,必须使用“LINKFLAGS”选项.
env = Environment() env.Append(CCFLAGS=['-g','-pg'],LINKFLAGS=['-pg']) env.Program(target='program1',source= ['program1.c'])
编译输出:
scons: Reading sconscript files ... scons: done reading sconscript files. scons: Building targets ... gcc -o program1.o -c -g -pg program1.c gcc -o program1 -pg program1.o scons: done building targets.
请注意链接阶段中的附加“-pg”.
解决方法
原文地址:https://www.jb51.cc/c/118726.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。