Question

In our application we use several dynamically linked libraries. We recently updated the version of one of these libraries. The developers of that library are providing a main method since this new version (Doing nothing more than printing Hello World).

The problem is that we are using GTest and GMock, which generate their own main method. When we now run our test binary, we just get "Hello World", so the wrong main method is being taken.

How can we force the main method of the tests to be used?

UPDATE: This seems to be a GMock/GTest issue. The main method is normally generated, but this is not the case as it finds an already existing main method now.

Was it helpful?

Solution

There are no ways around in your situation. You'll have to remove the main from the shared library. It simply doesn't belong there.

OTHER TIPS

I had a similar issue with two libraries having main methods, which was resolved by changing the order of the libraries to the linker.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top