Hello all,
I am newbie to CW. I am trying to run a project which is a mix of C and C++.
The project includes a static library which has both C and C++ code. There are no compilation errors but I am getting some strange linking errors:
Link Error: Undefined : '__init_cpp_exceptions'
Referenced from '__init_cpp_exceptions_reference' in Linker Generated File
Link Error: Undefined : '__fini_cpp_exceptions'
Referenced from '__fini_cpp_exceptions_reference' in Linker Generated File
I am using PowerPC EABI Linker. Version: Code Warrior PowerPC ISA, Release 8.5 Build 50425.
Any ideas ?
TIA
Solved! Go to Solution.
Hello
If you are able to build the newly created C++ project, I would recommend you start from there and add the required source files and configuration, instead of trying to re-invent the wheel,
CrasyCat
Hello
It looks like your project is not using the appropriate library for C++.
When you created your project did you indicate you are goingto program in C++?
Can you create a new project using the wizard and make sure you indicate the appropriate language in there?
CrasyCat
Thanks a lot for the reply.
The initial project is a C project which is running properly without any errors. Now what I am trying to do is to write an application which is in C++.
If I create a seperate C++ project it works fine which means CW is taking the C++ libraries properly and linking them.
Now 2 things are not clear to me:
1. Libraries are stored in
<MWERKS_INSTALL_PATH>\CodeWarrior PowerPC Comm V8.5\PowerPC_EABI_Support\Runtime\Lib\
Which library is used by default, there are so many variants (Runtime.PPCEABI.A/E/N/NC/S) ??
2. What is the need of following code in file __init_cpp_exceptions.cpp ?? Coz the two highlighed lines are giving me the errors.
#if __MWERKS__ && __PPC_EABI__
#pragma section ".ctors$10"
__declspec(section ".ctors$10")
extern void * const __init_cpp_exceptions_reference = __init_cpp_exceptions;
#if __dest_os != __eppc_vxworks
#pragma section ".dtors$10"
__declspec(section ".dtors$10")
extern void * const __destroy_global_chain_reference = __destroy_global_chain;
#pragma section ".dtors$15"
__declspec(section ".dtors$15")
extern void * const __fini_cpp_exceptions_reference = __fini_cpp_exceptions;
#endif /* __dest_os != __eppc_vxworks */
#endif /* __MWERKS__ && __PPC_EABI__ */
Thanks !!
Hello
>1. Which library is used by default, there are so many variants (Runtime.PPCEABI.A/E/N/NC/S) ??
The library you need to link to your application depends on the compiler options you are using.
Check MWERKS_INSTALL_PATH>\Help\PDF\Power Arch Build Tools Reference.pdf. There is a chapter Library and Support Code and a section Choosing an MSL Library there. This section describes the naming convention used for the library names.
> 2. What is the need of following code in file __init_cpp_exceptions.cpp ??
This defines a pointer to the section containing constructors and destructors for global class objects.
Are you getting the messages in the C++ application you created with the wizard?
As far as I remember the symbols __init_cpp_exceptions and __fini_cpp_exceptions are defined in the linker file (.lcf).
CrasyCat
Hi CrasyCat,
Thanks a lot for your help. Actually with my installation of CW the file ''Power Arch Build Tools Reference.pdf'' was missing. Its quite informative and helpful.
When I create a new C++ application with the wizard there are no errors or warnings.
And __init_cpp_exceptions and __fini_cpp_exceptions are functions defined in __init_cpp_exceptions.cpp file (?) My project has its own linker command file where these 2 symbols are not defined.
Hello
If you are able to build the newly created C++ project, I would recommend you start from there and add the required source files and configuration, instead of trying to re-invent the wheel,
CrasyCat