Knowledgebase: EurekaLog V7
7.x: "C++ requires a type specifier for all declarations" error
Posted by Aleksandr Alekseev on 01 May 2024 17:02

Question:

I get this error when building my C++ application with EurekaLog:

[bcc64 Error] Project.cpp(4): C++ requires a type specifier for all declarations

Is this a bug or am I doing something wrong?

 

Reason:

This issue has nothing to do with EurekaLog. One possible reason for this issue may be IDE being confused by your manual editing of your project's .cpp file and auto-inserting code in a wrong location.

For example, if you create a new application (without EurekaLog) and put code in the following order:

USEFORM("Unit1.cpp", Form1);
#include 
#pragma hdrstop
#include 
//---------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
  ...

you will get the mentioned error.

The correct order should be:

#include 
#pragma hdrstop
#include 
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
  ...

 

Solution:

Rearrange code in your main .cpp file in the correct order. Create a brand new empty application to serve as a reference point. Pay close attention to your forms.

 

See also:


Help Desk Software by Kayako Resolve