如何编译c ++而不包括cstdio和其他c标准库

时间:2015-10-02 15:49:51

标签: c++ c header-files autoconf

我是一名C程序员,具有最低的C ++专业知识。我一直在尝试从herehere下载并安装这些软件包。我运行configuremake以及dsr-pdb,我得到了一些错误或错误,例如

../include/dsrpdb/Point.h:69:14: error: 'assert' was not declared in this scope
assert(i < 3);

synaps我得

if g++ -DHAVE_CONFIG_H -I. -I. -I../include/synaps   -I/usr/include -I../include -O3 -g -O2 -MT Variables.o -MD -MP -MF ".deps/Variables.Tpo" -c -o Variables.o `test -f '../mpol/src/Variables.cpp' || echo './'`../mpol/src/Variables.cpp; \
    then mv -f ".deps/Variables.Tpo" ".deps/Variables.Po"; else rm -f ".deps/Variables.Tpo"; exit 1; fi
../mpol/src/Variables.cpp: In member function ‘std::string SYNAPS::Variables::operator[](int)’:
../mpol/src/Variables.cpp:16:25: error: ‘sprintf’ was not declared in this scope 
sprintf(str,"%d",i);

这些是错误,因为它们的源文件中没有#include <cassert>#include <cstdio>。我发现两个不同的开发者做到了这一点很奇怪。它让我想知道是否有一个编译器选项可以自动使用相应的c-header和库文件,或者它们是否可以在IDE中开发,让它们可以逃脱它?或者也许autoconf或做一些上游的事情?

1 个答案:

答案 0 :(得分:1)

gcc有一个-include选项,可以强制从命令行包含头文件。见https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC11