0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C++ Builder 10.2 Tokyo Update 3 > MinimizeName() > 未解決のシンボル > 対処 | XE4では動作していた

Last updated at Posted at 2018-04-04
動作環境
Windows 10 Pro (64bit) バージョン 1709
RAD Studio 10.2 Tokyo Update 3

エラー

MinimizeName()を使って表示文字列の短縮をしようとしたらエラーになった。

Unit1.cpp
//---------------------------------------------------------------------------

# include <vcl.h>
# pragma hdrstop

# include <FileCtrl.hpp>
# include "Unit1.h"
//---------------------------------------------------------------------------
# pragma package(smart_init)
# pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    String filePath = L"C:\Windows\System32\TemporaryFiles\readme.txt";

    Edit1->Text = filePath;

    Edit2->Text = MinimizeName(filePath, this->Canvas, Edit1->Width);
}
//---------------------------------------------------------------------------

Unit1.cppはビルドできるが、プロジェクトのメイクでエラーが出る。

[ilink32 エラー] Error: 未解決の外部シンボル '__fastcall Vcl::Filectrl::MinimizeName(System::UnicodeString, Vcl::Graphics::TCanvas *, int)' が ***\DEBUG\UNIT1.OBJ から参照されています

対処

#include <FileCtrl.hpp>

#include <Vcl.FileCtrl.hpp>
に変更する。

Unit1.cpp
//---------------------------------------------------------------------------

# include <vcl.h>
# pragma hdrstop

# include <Vcl.FileCtrl.hpp>
# include "Unit1.h"
//---------------------------------------------------------------------------
# pragma package(smart_init)
# pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    String filePath = L"C:\\Windows\\System32\\TemporaryFiles\\readme.txt";

    Edit1->Text = filePath;

    Edit2->Text = MinimizeName(filePath, this->Canvas, Edit1->Width);
}
//---------------------------------------------------------------------------

qiita.png

link

XE4では動作していた

XE4では#include <FileCtrl.hpp>でもエラーが出ない。

XE4の場合、本来は#include <Vcl.FileCtrl.hpp>にすべきであるが、#include <FileCtrl.hpp>でも動作するようになっていたようだ。

docwiki.embarcadero.comの記載でincludeファイルを確認する方が良いだろう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?