我有两个矩阵path[max][2]
和input_pair2[max][max]
,其中max是10,path_count是动态的并且小于max(比如6)。我想使用路径矩阵的元素作为input_pair2的索引,我正在执行以下代码。这在c编译器上可以正常工作,但是在我正在使用代码的框架中却给出了错误。该错误指示为input_pair2矩阵分配值0和1的问题。
typedef struct
{
int input_pair1[max][max];
int input_pair2[max][max];
}Pair;
typedef struct
{
int array[max][2];
int count;
}paths;
Pair augment_path(paths path, Pair pair )
{
for (int p = 0; p < path.count; p++)
{
if (pair.input_pair2[path.array[p] [0]] [path.array[p][1]] == 1)
pair.input_pair2[path.array[p][0]] [path.array[p][1]] = 0;
else
pair.input_pair2[path.array[p][0]] [path.array[p][1]] = 1;
}
return pair;
}
我得到的错误是
terminate called after throwing an instance of 'std::runtime_error'
what(): Unknown literal: 14100. Did you forget to return a value or assign a value to a OUTPUT variable?
Makefile:8: recipe for target 'output.gate.txt' failed
make: *** [output.gate.txt] Aborted (core dumped)
当我注释上面给出的代码时,错误消失并且产生了电路。