我已经使用C/C++大约7个月了,目前我正在尝试编写一小组线性代数程序.现在我正在尝试测试我的vector类,但是收到错误消息:
In file included from /usr/include/machine/_types.h:34,
from /usr/include/sys/_types.h:33,
from /usr/include/_types.h:27,
from /usr/include/unistd.h:71,
from /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cstdlib:50,
from linalgtest.cpp:8:
/usr/include/i386/_types.h:37: error: two or more data types in declaration of ‘__int8_t’
Run Code Online (Sandbox Code Playgroud)
在/usr/include/c++/4.2.1/stdexcept:43中包含的文件中,来自vector.cpp:8:/usr/include/c++/4.2.1/exception:40:错误:'#pragma'不允许这里
shell returned 1
Run Code Online (Sandbox Code Playgroud)
我正在运行Mac OS X 10.6.5,并检查了我的/usr/include/i386_types.h文件与http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/i386/_types.h中找到的文件.无论价值多少,它们看起来都是一样的.
以下是我的测试人员文件的内容
#include "linalg.h" // L7
#include <cstdlib> // L8: the offending line
#include <cmath> // L9
using namespace std;
double drand(double d) { return d*((double)rand()/RAND_MAX); }
int main(void) {
int n = 10;
double comps[10];
for (int …Run Code Online (Sandbox Code Playgroud)