Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:01:14+00:00 2026-06-17T13:01:14+00:00

I’ve been using the BDD framework Cucumber-cpp for a little while now without much

  • 0

I’ve been using the BDD framework Cucumber-cpp for a little while now without much issues, but extending the feature set of a module proved to raise some linker errors.

Setup:

  • Linux
  • Cucumber-cpp
  • makefile

If I start with the following:

# ./test1.feature
Feature: test with a single cpp file

Scenario:
    Given I'm a test
    When a trig happens
    Then light should be ON

and

// ./step_definitions/f1.cpp
#include <boost/test/unit_test.hpp>
#include <cucumber-cpp/defs.hpp>

#include <iostream>

using namespace std;

GIVEN("I'm a test")
{
    cerr << "Given..." << endl;
}

WHEN("a trig happens")
{
    cerr << "Trig!" << endl;
}

THEN("light should be on")
{
    cerr << "light ON..." << endl;
}

When I build this with make, it generates the test binary no problem and execution via cucumber works as expected.

But if I add another feature file (which describes another feature to test)

# ./test2.feature
Feature: another set of feature to impl.

Scenario: extra code
    Given I'm another test code
    When a trig happens
    Then light should be OFF

with the associated test file,

// ./step_definitions/f2.cpp
#include <boost/test/unit_test.hpp>
#include <cucumber-cpp/defs.hpp>

#include <iostream>

using namespace std;

GIVEN("I'm another test")
{
    cerr << "Given ANOTHER..." << endl;
}

compiling those 2 files now give the following linker error:

$  make build
mkdir -p ./objs
mkdir -p ./build
compiling step_definitions/f1.cpp
gcc -c -g -O0 -DDEBUG -Wall -Werror  -DBOOST_ALL_DYN_LINK  -I/usr/local/include -o objs/f1.o -c step_definitions/f1.cpp
compiling step_definitions/f2.cpp
gcc -c -g -O0 -DDEBUG -Wall -Werror  -DBOOST_ALL_DYN_LINK  -I/usr/local/include -o objs/f2.o -c step_definitions/f2.cpp
building feature-test...
gcc  -DBOOST_ALL_DYN_LINK  -I/usr/local/include  -L/usr/local/lib -o feature-test objs/f1.o objs/f2.o -lcucumber-cpp -lboost_regex -lboost_system -lboost_thread -lboost_unit_test_framework -lboost_date_time   
objs/f2.o: In function `toSourceString':
/usr/local/include/cucumber-cpp/internal/step/StepManager.hpp:161: multiple definition of `CukeObject0::cukeRegId'
objs/f1.o:/usr/local/include/cucumber-cpp/internal/step/StepManager.hpp:161: first defined here
objs/f2.o: In function `CukeObject0::body()':
/home/fred/dev/cuketest/step_definitions/f2.cpp:16: multiple definition of `CukeObject0::body()'
objs/f1.o:/home/fred/dev/cuketest/step_definitions/f1.cpp:15: first defined here
collect2: ld returned 1 exit status
make: *** [build] Error 1

Looking at the generated obj files, gives this:

$  nm objs/f2.o | grep "cukeRegId"
0000000000000395 t _GLOBAL__sub_I__ZN11CukeObject09cukeRegIdE
0000000000000000 B _ZN11CukeObject09cukeRegIdE
$  nm objs/f1.o | grep "cukeRegId"
000000000000069e t _GLOBAL__sub_I__ZN11CukeObject09cukeRegIdE
0000000000000000 B _ZN11CukeObject09cukeRegIdE
0000000000000004 B _ZN11CukeObject19cukeRegIdE
0000000000000008 B _ZN11CukeObject29cukeRegIdE

Problem looks like the cukeRegId functions have exactly the same decorated name in the 2 obj files, causing linker error.
Now, I’m stuck as to how I can prevent this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:01:15+00:00Added an answer on June 17, 2026 at 1:01 pm

    digging up the internet on this, I found a bug entry related to that specific issue.
    It turned out that in each cpp file, we must declare a unique define value for CUKE_OBJECT_PREFIX in order to avoid object naming clash at linker time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am using JSon response to parse title,date content and thumbnail images and place
this is what i have right now Drawing an RSS feed into the php,
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm interested in microtypography issues on the web. I want a tool to fix:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.