Link error: symbol has different size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Link error: symbol has different size

2,985 Views
Psych0o0
Contributor I

Hello,

 

I have a warning during linking I don't understand: "L1827: Symbol __as__appFRC3app has different size in app.cpp.o (102 bytes) and main.cpp.o (103 bytes)"...

 

The program seems to work correctly, but this warning stays incomprehensible to me.

 

Here is app.h:

 

#ifndef APP_H#define APP_H#include "btn.h"#include "pot.h"#include "brt.h"//#include "led.h"   class app{    private:        btn bouton1;        btn bouton2;        pot poti1;        pot poti2;          inp* inputs[ 4 ];            brt bruiteur;        int frequence;        int volume;        int on;    public:        app();        void Init();        void ScanInputs();        void RefreshOutputs();  };#endif

 

and main.cpp:

 

 
#include <hidef.h>       /* common defines and macros */#include <mc9s12dp256.h> /* derivative information    */#include "OS.h"#include "OS_Task.h"#include "app.h"#include "stack.h"#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"#define COP_RESET() ARMCOP = 0x00     app Application;extern "C" void taskScan( void ){    Application.ScanInputs();}extern "C" void taskRefresh( void ){    Application.RefreshOutputs();}extern "C" void taskFeedCop( void ){    _FEED_COP();}extern "C" void taskCheckStack( void ){    if ( !STACK_chk() )        COP_RESET();   }void main( void ){    OS_Init();    Application.Init();      OS_Run();}

 

 

I've noticed that when I remove the comment for "led.h" inclusion (which is not needed here) in app.h file, the warning disappears !

 

Can someone help me please ?

Message Edited by Psych0o0 on 2009-12-19 12:44 PM
Labels (1)
0 Kudos
Reply
4 Replies

1,617 Views
jbezem
Contributor III

I'd suggest you create preprocessor output from both app.cpp and main.cpp, and check the declarations of 'app' in both cases. Chances are, some preprocessor replacements have come to haunt you. I could imagine the member 'on' (or possibly one of the types btn/pot), so common and small, being used for some preprocessor macro in one of the header files included in only one of the compilation units, that its meaning gets thwarted. The latter is just a pure guess from my side, it will probably be something completely different, but I've experienced such anomalies several times over the last 30 years...

 

HTH,

 

Johan

0 Kudos
Reply

1,617 Views
CompilerGuru
NXP Employee
NXP Employee

I guess the difference in between the versions of the assignment operator are caused by something else,

for example by inlining a function in one version and by not inlining it in another instance.

Could also be that both versions are ok, just different.

I don't think the warning is showing a real issue, you can either disable the warning or provide a custom version of the assignment operator.

If the class should be assignable provide a custom implementation of it in a cpp file, if the class should not be assignable just declare the assignment operator as private member without defining it.

 

Daniel

 

0 Kudos
Reply

1,617 Views
CrasyCat
Specialist III

Hello

 

I would guess there is a difference between the declaration and the definition of the specified symbol.

Woudl be interesting to know what exactly you are doing in led.h.

 

Also do you have a #pragma align in there.

 

CrasyCat

0 Kudos
Reply

1,617 Views
Psych0o0
Contributor I

Here is led.h:

 

#ifndef LED_H#define LED_H#ifdef __cplusplusextern "C"{#endifvoid led_open (void);void led_close (void);void led_write(int first, int last);#ifdef __cplusplus}#endif#endif

 

 

I don't have a #pragma align anywhere...

0 Kudos
Reply