Cannot find boost header files using #include <boost/asio/file.hpp>

91 views Asked by At

Compiler is saying that it cannot find header files using the #include paths already included in every header file in the boost files. Have tried adding include paths in c++ properties file, but it still won't work. If I change the header from #include <boost/asio/file.hpp> to #include <asio/file.hpp> it works. How can I make it so that #include <boost/asio/file.hpp> will also work. If I can't figure this out, I will have to change every single #include path by hand which would take forever.

Properties file:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "boost_1_82_0/**",
                "boost_1_82_0/boost/asio/**",
                "boost_1_82_0/boost/**",
                "boost_1_82_0/boost",
                "asio/include/boost/**",
                "asio/include/boost",
                "asio/include/boost/",
                "asio/include",
                "asio/include/"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}

Makefile:

CXX ?= g++
CXXFLAGS ?= -Wall -Werror -pedantic -g --std=c++17 -Wno-sign-compare -Wno-comment -fsanitize=address -fsanitize=undefined -Iinclude

UNAME := $(shell uname -s)

# ifeq "$(UNAME)" "Darwin"
#   CXXFLAGS += -fsanitize=address -fsanitize=undefined
# else
#   CXXFLAGS += -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG
# endif

# Make server
launch_server.exe: launch_server.cpp
    $(CXX) $(CXXFLAGS) launch_server.cpp -o launch_server.exe
# Make client
launch_client.exe: launch_client.cpp
    $(CXX) $(CXXFLAGS) launch_client.cpp -o launch_client.exe


# Remove automatically generated files
clean :
    rm -rvf *.exe *~ *.out *.dSYM *.stackdump

I tried adding in several include paths to try and make boost/asio work as an #include path, but it still won't work. File Structure:
--test_multiplayer
---launch_client.cpp
---launch_server.cpp
---makefile
---boost_1_82_0
----boost
-----asio
-----various folders with hpp files for asio

All of the ASIO headers use #include <boost/asio/file.hpp>, but only <asio/file.hpp> seems to work, how to make existing headers work?

Tried adding a new include path in the makefile recipe:

CXX ?= g++
CXXFLAGS ?= -Wall -Werror -pedantic -g --std=c++17 -Wno-sign-compare -Wno-comment -fsanitize=address -fsanitize=undefined

UNAME := $(shell uname -s)

INC= -I../boost_1_82_0/boost

# ifeq "$(UNAME)" "Darwin"
#   CXXFLAGS += -fsanitize=address -fsanitize=undefined
# else
#   CXXFLAGS += -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG
# endif

# Make server
launch_server.exe: launch_server.cpp
    $(CXX) $(INC) $(CXXFLAGS) launch_server.cpp -o launch_server.exe
# Make client
launch_client.exe: launch_client.cpp
    $(CXX) $(INC) $(CXXFLAGS) launch_client.cpp -o launch_client.exe


# Remove automatically generated files
clean:
    rm -rvf *.exe *~ *.out *.dSYM *.stackdump

It didn't work. Same error message:

c++ -I../boost_1_82_0/boost -Wall -Werror -pedantic -g --std=c++17 -Wno-sign-compare -Wno-comment -fsanitize=address -fsanitize=undefined launch_client.cpp -o launch_client.exe In file included from launch_client.cpp:13: ./boost_1_82_0/boost/asio.hpp:20:10: fatal error: 'boost/asio/any_completion_executor.hpp' file not found #include <boost/asio/any_completion_executor.hpp> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [launch_client.exe] Error 1

0

There are 0 answers