Linking error to advapi32 when using BOOST_AUTO_LINK_SYSTEM

Open Beginner friendly
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
build-system

Research direction

Start with src/random_device.cpp around the auto_link.hpp include and review how BOOST_AUTO_LINK_SYSTEM interacts with BOOST_AUTO_LINK_NOMANGLE. Reproduce the Windows link using BOOST_AUTO_LINK_SYSTEM and verify that the generated library name resolves to advapi32.lib without a linker error.

Written by the indexing model from the issue text.

Description

Under Windows, the code in random_device.cpp automatically links to the library advapi32.lib.
This uses the auto_link.hpp header combined with the macro BOOST_AUTO_LINK_NOMANGLE to produce the correct library file name to link.

As of version 1.69, it is also possible to use the macro BOOST_AUTO_LINK_SYSTEM, which is exclusive with the NOMANGLE macro.
Using the former causes a link error as the library file name added by auto_link is incorrect.
I would suggest undefining the BOOST_AUTO_LINK_SYSTEM before including the auto_link header in random_device.cpp.

https://github.com/boostorg/random/blob/ed7ab807e6f9c8e99f380cd21f5a00058b985d49/src/random_device.cpp#L51

Dominant language
C++
Stars
42
Forks
76
Avg merge
3d 22h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/random

All issues in boostorg/random

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.