CW6.6 - MPC555 - Link error: Static initializers must be called before 'main'

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

CW6.6 - MPC555 - Link error: Static initializers must be called before 'main'

2,737 Views
LBatCEi
Contributor I
I have created a new project by copying an existing (and working) project to a new directory.  I added one new C source file and one new C header file (and edited some existing C source and header files).  When I build (within the IDE) I get the following error:

Link Error   : Static initializers must be called before 'main'.
Please see '_ctors' in __ppc_eabi_init.cpp for example.

Project: ifc.mcp, Target: rom

I found a note in the file CLT_EABI_PPC_Tools_Notes.txt that indicates that -Cpp_exceptions should be turned off.  I checked the Target settings in the IDE and this option is turned off.  There are no C++ files in my project.

Why am I getting this error and how can I fix it?  Has anyone else seen this before?

 
Thanks

Message Edited by Alban on 2007-03-28 08:28 PM

Labels (1)
0 Kudos
5 Replies

527 Views
LBatCEi
Contributor I
The target processor is Embedded PowerPC MPC555 with CodeWarrior version 6.6.
0 Kudos

527 Views
LBatCEi
Contributor I
If I change calls to sinf() and cosf() to sin() and cos() the Link error goes away.  It doesn't seem to matter whether the variables used in these calls are declared as float or double -- with the float versions of these library calls I get the Link error -- with the double versions I don't.
 
Any ideas?
0 Kudos

527 Views
Voxan
Contributor III
Hi LBatCEi,

could you please check the "Force C++ compilation" is not set in your C/C++ Language panel.

FYI: the current version os CW for 5xx processor is v8.7

Hope this helps...

Best Regards
0 Kudos

527 Views
LBatCEi
Contributor I
I don't see a 'Force C++ Compilation' option on the C/C++ Language settings page.  Below is the xml result from "Export Panel..." on that settings page. 
 
I am aware that we are not using the latest version of CW for the EPPC/5xx but, as you may know, there is a strong "if it ain't broke, don't fix it" mentality when it comes to delivering software (and other things) to the military.  Therefore we are continuing to use the compiler version that was current when we started delivering this software product.
 
Code:
<—xml version="1.0" encoding="UTF-8" standalone="yes" –><˜codewarrior exportversion="1.0" ideversion="5.0" ™><!DOCTYPE EXPORTEDPANEL [<!ELEMENT EXPORTEDPANEL (NAME, (SETTINGLIST|VALUE))><!ELEMENT SETTINGLIST (SETTING+)><!ELEMENT SETTING (NAME?, (VALUE|(SETTING+)))><!ELEMENT NAME (#PCDATA)><!ELEMENT VALUE (#PCDATA)>]><EXPORTEDPANEL>    <NAME>C/C++ Compiler</NAME>    <SETTINGLIST>        <SETTING><NAME>MWFrontEnd_C_cplusplus</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_checkprotos</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_arm</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_trigraphs</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_onlystdkeywords</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_enumsalwaysint</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_mpwpointerstyle</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_prefixname</NAME><VALUE>ansi_prefix.PPCEABI.bare.rom.h</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_ansistrict</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_mpwcnewline</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_wchar_type</NAME><VALUE>1</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_enableexceptions</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_dontreusestrings</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_poolstrings</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_dontinline</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_useRTTI</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_multibyteaware</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_unsignedchars</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_autoinline</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_booltruefalse</NAME><VALUE>1</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_direct_to_som</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_som_env_check</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_alwaysinline</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_inlinelevel</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_ecplusplus</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_objective_c</NAME><VALUE>0</VALUE></SETTING>        <SETTING><NAME>MWFrontEnd_C_defer_codegen</NAME><VALUE>0</VALUE></SETTING>    </SETTINGLIST></EXPORTEDPANEL>

 
0 Kudos

527 Views
CrasyCat
Specialist III
Hello
 
The check box is called "Force C++ Compilation" on CodeWarrior PPC V8.0 and higher.
It is called "Activate C++ Compiler" in V6.6
That is the check box that needs to be unchecked.
 
Note that I could reproduce that issue with CodeWarrior for PPC V6.6, but same source code can be processed without issue on V8.7.
 
So I would highly recommend you to upgrade to V8.7
 
CrasyCat
0 Kudos