函数声明调用问题.h文件
主程序:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "CRC.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int a, b, c;
a = 10;
b = 20;
c = Add(a , b);
}
//---------------------------------------------------------------------------
Fun.C:
#include "CRC.h"
// 构造 16 位 CRC 表
int Add( int a , int b )
{
return a+b;
}
//---------------------------------------------------------------------------
FUN.h:
int Add( int a , int b );
运行程序提示:
[linker error]Unresolved external 'Add(int, int)' referenced from d:test\unit1.obj