Jump to content
Registration disabled at the moment Read more... ×
Sign in to follow this  
tester1234

Annoying warning message a'attribute declaration must precede definition'

Recommended Posts

After migrating from borland to clang, we get this annoying warning, which I haven't been able to resolve.

Is this a known issue or are there any workarounds?

USEFORM("Label.cpp", fmLabelView);
USEFORM("Test.cpp", fmTestView);
USEFORM("Repro.cpp", fmReproView);
[bcc32c Warning] Label.cpp(123): attribute declaration must precede definition
[bcc32c Hint] sysclass.h(137): expanded from macro 'USEFORM'
[bcc32c Hint] sysmac.h(377): expanded from macro 'DELPHICLASS'
[bcc32c Hint] test.h(58): previous definition is here
class  TfmLabelView : public TfmFormTemplate

 

 

Share this post


Link to post
10 minutes ago, Lars Fosdal said:

Find out where that attribute is declared and include the file?

So at the bottom of test.h we have

extern PACKAGE TfmLabelView* fmLabelView;
Edited by tester1234

Share this post


Link to post
On 1/30/2023 at 6:38 AM, tester1234 said:

And test.h is included in the file that contains


USEFORM("Label.cpp", fmLabelView);

I assume you figured this out, eh?

Share this post


Link to post

The warning is caused by having #include "Label.h" *before* the USEFORM.

#include "Label.h"
...
USEFORM("Label.cpp", fmLabelView);

Try this:

USEFORM("Label.cpp", fmLabelView);
...
#include "Label.h"

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×