CxxTest compiling, missing main

邮差的信 提交于 2019-12-13 01:34:12

问题


I am using CxxTest for unit testing. I followed the docs.

First command I executed was:

cxxtestgen --error-printer -o runner.cpp MyTestSuite1.h

Output of the command is runner.cpp file.

According to the documentation, next command should be:

g++ -o runner -I(location_of_the_cxxTest_headers) runner.cpp

but I am unable to execute it, I am receiving the error about missing entry point. In other words, runner.cpp is missing main.

Same thing happens with the test files included with CxxTest.

I am running Windows 8.1.

My question is marked as a duplicate, but I didn't find solution in the another question. I am not building a GUI application. Question is about CxxTest and how does it even start without a main() function? Where is the entry point?


回答1:


I have found a solution after looking at a python script cxxtestgen.py which is used to generate runner.cpp. There is an if statement at the beginning of a writeMain(output) function which writes main function in an output file:

if not (options.gui or options.runner):
       return

At least one of the two options, --runner=CLASS and --gui=CLASS is required when generating output file from test suites. After adding one option everything runs fine.



来源:https://stackoverflow.com/questions/37644452/cxxtest-compiling-missing-main

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