注册 登录
编程论坛 C++ Builder

为什么会出现这样的错误!

yuyunliuhen 发布于 2006-11-04 18:09, 1137 次点击
[Linker Error] Unresolved external '_Form1' referenced from D:\BORLAND C++ BUILDER 6\PROJECTS\PROJECT2.OBJ
[Linker Error] Unresolved external 'TForm1::' referenced from D:\BORLAND C++ BUILDER 6\PROJECTS\PROJECT2.OBJ
我用C FREE 可以编译出程序,但是用C++ BUILDER 却出现这样的错误,请问是为什么啊?
程序如下:
#include<iostream>
using namespace std;
const int len =66;
const int divs =6;
void subdivide(char ar[],int low,int high,int level);
int main()
{
char ruler[len];
int i;
for(i=1;i<len-2;i++)
ruler[i]=' ';
ruler[len-1]='\0';
int max =len -2;
int min =0;
ruler[min]=ruler[max]='|';
cout<<ruler<<"\n";
for(i=1;i<=divs;i++)
{
subdivide(ruler,min,max,i) ;
cout<<ruler<<"\n";
for(int j=1;j<len-2;j++)
ruler[j]=' ';
}
return 0;
}
void subdivide(char ar[],int low,int high,int level)
{
if (level==0)
return;
int mid=(high+low)/2;
ar[mid]='|';
subdivide(ar,low,mid,level-1);
subdivide(ar,mid,high,level-1);
}
4 回复
#2
Meixu2006-11-04 20:56

我认为你应该新建一个:Console Wizard
在把程序代码加入就可以编译了。

#3
yuyunliuhen2006-11-04 21:42
新建了还是不能编译啊~
还是同样的错误~
#4
Meixu2006-11-05 19:42

| |
| | |
| | | | |
| | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
请按任意键继续. . .(这是测试的结果)
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
#include<iostream>
using namespace std;
const int len =66;
const int divs =6;
void subdivide(char ar[],int low,int high,int level);
int main()
{
char ruler[len];
int i;
for(i=1;i<len-2;i++)
ruler[i]=' ';
ruler[len-1]='\0';
int max =len -2;
int min =0;
ruler[min]=ruler[max]='|';
cout<<ruler<<"\n";
for(i=1;i<=divs;i++)
{
subdivide(ruler,min,max,i) ;
cout<<ruler<<"\n";
for(int j=1;j<len-2;j++)
ruler[j]=' ';
}
system("pause");
}
void subdivide(char ar[],int low,int high,int level)
{
if (level==0)
return;
int mid=(high+low)/2;
ar[mid]='|';
subdivide(ar,low,mid,level-1);
subdivide(ar,mid,high,level-1);
}

//---------------------------------------------------------------------------

#5
yuyunliuhen2006-11-07 20:43
恩,谢谢!

1