unit test in eclipse g++

一世执手 提交于 2019-12-20 04:12:58

问题


I am using Eclipse to develop some projects and implement unit test by using google test. everything was fine this morning. I can build project and run unit tests. however, after i commit the local changes and then pull the codes from repository using git tortoise, the unit tests stopped working any more. I still can build the project.

I got msg:

Unknown error during parsing Google Test module output: unexpected test module output

this is the msg in the console window:

The target endianness is set automatically (currently little endian)
[New Thread 4496.0x520]

and the project would stop running before we even step into the main function in the unit test. Since, the compiler gave me so little info, i wonder if any one here might have a clue.


回答1:


I ran into the error msg "...:unexpected test module output" when I added a main function and DID NOT exclude it from test build (and apparently g++ linker did not complain about same symbol error, you should be able to see it from the build msg for test build).

I excluded my app main from test build (right click on your app main, go to Resources Configuration, then Exclude from Build..., and finally check your test build and click OK), the test ran without any problem.




回答2:


It can be a little irrelevant already, but I had the same problem, then I noticed wrong C++ Aplication value for my GoogleTest Configuration, changed it and now everything is fine.

I had the option for Debug config there. (Run -> Run Configurations... -> C/C++ Aplication). Eclipse changed it itself somehow.



来源:https://stackoverflow.com/questions/23660118/unit-test-in-eclipse-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!