How to ignore the main method from a dynamic linked library in C ++

In our application, we use several dynamically linked libraries. We recently updated the version of one of these libraries. The developers of this library provide the main method with this new version (doing nothing but print Hello World).

The problem is that we use GTest and GMock, which generate our own main method. When we run our test binary, we just get "Hello World", so the wrong main method is accepted.

How can we get the main test method to be used?

UPDATE: This seems to be a problem with GMock / GTest. The main method is usually generated, but this is not so, since it finds an existing main method.

+6
source share
2 answers

There are no ways in your situation. You will have to remove the core from the shared library. He just does not belong.

+5
source

I had a similar problem with two libraries having basic methods that were solved by changing the order of the libraries on the linker.

0
source

Source: https://habr.com/ru/post/910686/


All Articles