Contenuto principale

Troubleshoot Building GoogleTest Tests from Polyspace Platform Projects

Issue

You can import GoogleTest tests into a Polyspace® Platform project and build them using a similar workflow as tests authored using the Polyspace Test™ C/C++ xUnit API. Before building your GoogleTest tests, you have to set up your project configuration so that the appropriate GoogleTest libraries can be found during the build. If the project configuration is not correctly set up, you might encounter errors during build. This topic covers some possible resolutions for the GoogleTest build errors.

Possible Solutions

Build Tests and GoogleTest Libraries Using Same Compiler

To be able to build GoogleTest tests, you must specify the GoogleTest libraries using these Polyspace options in your project configuration:

If the libraries were built using a compiler that is different from the compiler in your Polyspace Platform project configuration, the required GoogleTest definitions might not be found during build and you run into linking errors such as:

undefined reference to <symbolName>

For instance, your build might be showing errors because your GoogleTest libraries were built using a Visual Studio® compiler but you are using a MinGW compiler in your Polyspace Platform project. For more information on how to find the compilers used for Polyspace Platform project builds, see Specify C/C++ Compilers for Testing in Polyspace Platform User Interface.

Build Tests for Host Execution

Similar to the previous case, you might be attempting to build your GoogleTest tests for on-target execution when the GoogleTest libraries in your project configuration were compiled only for on-host execution.

To check if you are building your tests for on-target execution, see your specifications for the option Target board name (Testing).

See Also

| |

Topics