0

So this has been asked alot of times but I havent been able to solve my problem within 2 hours, I hope someone can help me, probably there are only 1 or 2 minor things off...

Im including a .hpp in my file, vscode has no problems (includepath configured) but when I try to compile the program there is an error: no such file. Codesnippets below.

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe",
            "includePath": [
                "D:/foo/bar/boost_1_62_0/boost"
            ],
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

tests.cpp

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE HELLO
#include "test/unit_test.hpp"

int substract (int a, int b) {
    return a-b;
}

BOOST_AUTO_TEST_CASE(subtractTest) {
    BOOST_CHECK(substract(9,6) == 3);
}

cmd compile command

g++ -o tests -l/D:/foo/bar/boost_1_62_0/boost/test/unit_test.hpp -I/D:/foo/bar/boost_1_62_0/boost/test tests.cpp

fatal error: boost/test/unit_test.hpp: No such file or directory

any help is greatly appreciated!

cdol
  • 28
  • 6

1 Answers1

2

If you ended the include path with ".../boost", the #include directive shouldn't start with boost. What you did resolves to "D:/foo/bar/boost_1_62_0/boost/boost/test/unit_test.hpp"