Cucumber-cpp some LINK errors

27 views
Skip to first unread message

Shareef Chachu

unread,
Jul 14, 2017, 2:52:52 AM7/14/17
to Cukes

I am testing a c++ program using Cucumber framework. Documentation for Cucumber-cpp. Basically, I needed to include some of the library files such as boost, gtest etc. Also, build Ruby Cucumber gem. I have finished all of them.


I am currently using visual studio 2017 community version. From the documentation of cucumber-cpp, I downloaded the file and started trying one of the examples they provided (Calc). I added the header file (Calculator.h), source file (Calculator.cpp), test file (GtestCalculatorSteps.cpp) and finally addition.feature.


After debugging, I get some link errors. I have attached a screenshot of the errors. 


Can anyone help me by telling how do I fix this?

Capture.PNG

Paolo Ambrosio

unread,
Jul 17, 2017, 2:11:07 AM7/17/17
to cu...@googlegroups.com
Hi Shareef,

To compile step definitions in Cucumber-CPP you need to link them to
the Cucumber-CPP static library (that is produced by the project
root), Boost libraries (thread, system, regex, date_time,
program_options, filesystem) and GoogleTest or Boost::Test depending
on the chosen testing framework.

If you look at the CMakeLists.txt in the Calc example
(https://github.com/cucumber/cucumber-cpp/blob/master/examples/Calc/CMakeLists.txt)
you'll find:

target_link_libraries(BoostCalculatorSteps Calc ${CUKE_LIBRARIES}
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})

This means that to link BoostCalculatorSteps , you need:
- the Calc library (system under test)
- the Cucumber-CPP library and the Boost libraries (listed above)
- Boost::Test

For GTestCalculatorSteps, you need to replace Boost::Test with
GoogleTest instead.


HTH,
Paolo
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages