2016-06-18 110 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

相關問題