2016-06-18 105 views
0

虽然我已经包含标题vcl.h,但在控制台应用程序中尝试使用TStringList对象时,出现连接器错误。我特别的问题是如何在控制台应用程序中使用TStringList和其他vcl组件。这是我的代码片段,下面是链接器错误。如何在控制台应用程序中使用vcl组件?

[ILINK32 Error] Error: Unresolved external 'Classes::TStringList::' referenced from XXX.OBJ

#pragma hdrstop 

#include <tchar.h> 
#include <vcl.h> 
#include <iostream.h> 
#include <conio.h> 


#pragma argsused 

using namespace std; 

int _tmain(int argc, _TCHAR* argv[]) 
{ 
    TStringList* AList = new TStringList; 
    delete AList; 
    return 0; 
} 

回答

3

当您使用Console Wizard创建项目,确保启用“使用VCL”复选框:

Creates an application that can contain VCL components. This option is available only if you choose C++ as your Source Type. Checking this option causes the IDE to include vcl.h and to change the startup code and linker options for compatibility with VCL objects.

screenshot

相关问题