传递动态数组功能

时间:2012-09-27 10:01:44

标签: c++ linker-errors

  

可能重复:
  What is an undefined reference/unresolved external symbol error and how do I fix it?

我正在将一个动态数组的整数传递给一个函数,我无法让它工作。

int * tempP1;

tempP1 = new int [numP1+1];

呼叫:

Polynomial P1(numP1, tempP1);

原型:

Polynomial(int tempNum, int * tempPoly);

功能:

Polynomial::Polynomial(tempNum, int *tempPoly)

错误:

Undefined symbols for architecture x86_64:
  "Polynomial::Polynomial(int, int*)", referenced from:
     _main in ccDOuaGg.o
  "Polynomial::~Polynomial()", referenced from:
     _main in ccDOuaGg.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

任何帮助都会非常感激:)

1 个答案:

答案 0 :(得分:0)

我弄明白了这个问题。我正在以错误的方式编译这个程序。