2017-08-18 6 views
0

に私は私のアプリのコードを書いていたし、今私は私が作った混乱を修正することはできませんし、私は正確にIDE 再定義C++ Builderの10.1

に何が起こっているのか分からない:C + +ビルダー10.1ベルリン(FMX)

ERROR1:

[bccaarm Error] texts.cpp(12): redefinition of 'Form4' 
texts.cpp(12): previous definition is here 

ERROR2:

[bccaarm Error] texts.cpp(14): redefinition of 'TForm4' 
texts.cpp(14): previous definition is here 

texts.cpp:

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

#include <fmx.h> 
#pragma hdrstop 

#include "texts.h" 
//--------------------------------------------------------------------------- 
#pragma package(smart_init) 
#pragma resource "*.fmx" 


TForm4 *Form4; 
//--------------------------------------------------------------------------- 
__fastcall TForm4::TForm4(TComponent* Owner) 
    : TForm(Owner) 
{ 
} 
//--------------------------------------------------------------------------- 

texts.h:

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

#ifndef textsH 
#define textsH 
//--------------------------------------------------------------------------- 
#include <System.Classes.hpp> 
#include <FMX.Controls.hpp> 
#include <FMX.Forms.hpp> 
#include <FMX.Controls.Presentation.hpp> 
#include <FMX.StdCtrls.hpp> 
#include <FMX.Types.hpp> 
//--------------------------------------------------------------------------- 
class TForm4 : public TForm 
{ 
__published: // IDE-managed Components 
    TLabel *erremptb; 
    TLabel *errnofloat; 
    TLabel *errjustpos; 
    TLabel *errnoneg; 
    TLabel *errinp2; 
    TLabel *errinp1; 
private: // User declarations 
public:  // User declarations 
    __fastcall TForm4(TComponent* Owner); 
}; 
//--------------------------------------------------------------------------- 
extern PACKAGE TForm4 *Form4; 
//--------------------------------------------------------------------------- 
#endif 

あなたはより多くの情報が必要な場合はちょうど私にそれを伝え、あなたがテキストで

+0

私はあなたが示しているコードに間違いはありません。再定義は発生しません。 –

+0

私はあなたが 'texts.cpp'をどこかに2回入れていると思います。これをチェックするには '#ifndef textsCPP #define textsCPP ... endif'文を(' texts.h'のように)追加します。コンパイルされた場合はそのようになります。私の賭けはあなたがどこかで別のフォームにそれを含めることです... – Spektre

答えて

0

を含ま年末までですそれをコンパイルした後、私はコメントを外してコードを実行しますが、それ以降は私のトリックでもう動かないので、私は別の方法で問題を解決します。 あなたの試行に感謝しますが、それは愚かなRadstudioのバグでした

0

にラインをそれを解決するために私を助けている場合、私はとても幸せになります。 cpp

TForm4 *Form4; 

は、Form4の再定義です。最初の定義は以前にそれは私が私が私のtexts.cppファイルをコメントすることを削除する前に、私はそのフォームを削除し、問題 を解決するために、他のSTHを行うIDEのバグだったとtexts.h

extern PACKAGE TForm4 *Form4; 
+1

いいえ、それは再定義ではありません。 texts.cppには定義が1つしかありません。もう一つは単なるextern宣言です。 –