IBM Support

C and C++ BaseStation undefined reference errors

Troubleshooting


Problem

This technote explains how to undefined reference errors, that might occur when using IBM® Rational® Test RealTime®.

Symptom

When attempting to build the BaseStation project within Rational Test RealTime, numerous "undefined reference" errors are generated:



    /home/purifyplus/BaseStation/clinuxgnu3_2/UmtsConnection.o: In function `_AttInDtor21351278731::_atl_avoid_unused_warning(void)':
    /home/purifyplus/BaseStation/clinuxgnu3_2/UmtsConnection.aug.cpp(.text+0xf6): undefined reference to `endl(ostream &)'
    /home/purifyplus/BaseStation/clinuxgnu3_2/UmtsConnection.aug.cpp(.text+0x133): undefined reference to `cerr'
    /home/purifyplus/BaseStation/clinuxgnu3_2/UmtsConnection.aug.cpp(.text+0x138): undefined reference to `ostream::operator<<(char const *)'
    /home/purifyplus/BaseStation/clinuxgnu3_2/UmtsConnection.aug.cpp(.text+0x143): undefined reference to `ostream::operator<<(char const *)'
    /home/purifyplus/BaseStation/clinuxgnu3_2/UmtsConnection.aug.cpp(.text+0x14e): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))' .....

Cause

A likely cause for the "undefined reference" is that the compilation and link phase are being done with the gcc compiler instead of the g++ compiler. To confirm this, set the environment variable ATTOLSTUDIO_VERBOSE to 1 or within the GUI go to Edit -> Preferences -> Project and make sure "Verbose output" is checked. You will then have to rebuild the project and review the build output.

NOTE: Unlike gcc, g++ will automatically link with the C++ library. This can happen during the creation of the node if the C Target Deployment Port (TDP) is selected instead of the C++ Target Deployment Port (TDP). While a project can contain multiple TDPs, only one can be active at a time.

Resolving The Problem

To resolve the "undefined reference" errors, select the correct TDP from the drop-down box on the menu bar of the Test RealTime GUI. If the correct TDP is not listed there, then go through the "New Project Wizard" making sure to select the correct TDP when prompted

[{"Product":{"code":"SSSHUF","label":"Rational Test RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003.06.00;2003.06.12;2003.06.13;2003.06.14;2003.06.15","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

120513319

Document Information

Modified date:
16 June 2018

UID

swg21120825