Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Macro BOOST_ASIO_HAS_FILE not defined

Open
#409 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp

Research direction

Start with the minimal program using boost/asio/basic_stream_file.hpp and inspect boost/asio/detail/config.hpp, comparing the reported Boost 1.80/1.81 builds and GCC 12.2.1 environment. Determine whether BOOST_ASIO_HAS_FILE should be enabled for this configuration and verify the result with the provided compilation command; done means the cause and a reproducible supported fix are established.

Written by the indexing model from the issue text.

Description

I am trying to compile basic program:


#include <boost/asio/basic_stream_file.hpp>
#include <iostream>

auto main() -> int { auto b = boost::asio::basic_stream_file{}; }

g++ ./not_compiling.cpp -std=c++20 -lboost -o boost_testing
I receive following compilation error

$ g++ ./not_compiling.cpp -std=c++20 -lboost -o boost_testing
./not_compiling.cpp: In function ‘int main()’:
./not_compiling.cpp:5:38: error: ‘boost::asio’ has not been declared
    5 | auto main() -> int { auto b = boost::asio::basic_stream_file{}; }

I believe that it is an issue with undefined macro BOOST_ASIO_HAS_FILE.

I've tried installing boost from arch repo, compiling from source on boost-1.81.0/1.80.0 branches with the same result.

extra/boost 1.81.0-3 [installed]
    Free peer-reviewed portable C++ source libraries (development headers)
g++ --version
g++ (GCC) 12.2.1 20230201

Manually defining macro in /usr/include/boost/asio/detail/config.hpp did not help and generated another compilation errors.

Now, why is that macro not defined? How can I fix it?

Dominant language
C++
Stars
1.6k
Forks
485
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

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/asio

All issues in boostorg/asio

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.