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

関連する問題