1

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?

Nikola Lošić
  • 479
  • 1
  • 6
  • 18
  • Possible duplicate of [undefined reference to \`WinMain@16'](http://stackoverflow.com/questions/5259714/undefined-reference-to-winmain16) – Ivan Aksamentov - Drop Jun 05 '16 at 16:58
  • @Drop How is that a duplicate? I am not even building a GUI application. According to the answer of that question my problem should be fixed with options: -Wl,-subsystem,windows but it is not. Question is about CxxTest and how it is possible to run in console without main. My problem is that CxxTest doesn't generate main, how should then I start the tests? – Nikola Lošić Jun 05 '16 at 17:38

1 Answers1

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.

Nikola Lošić
  • 479
  • 1
  • 6
  • 18