0

I have an error : asio.hpp: No such file or directory.

The compiler won't recognize the library asio.hpp.

I tries <asio.hpp> and "asio.hpp" . both doesnt work.

asio.hpp is located in "C:\Users\mines\Desktop\Projects\Server\asio-1.28.0\include" and I update including path c_cpp_properties.json.

My c_cpp_properties.json :

{
"configurations": [
    {
        "name": "Win32",
        "includePath": [
            "${workspaceFolder}/**",
            "C:\\Users\\mines\\Desktop\\Projects\\Server\\asio-1.28.0\\include"
        ], 
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE"
        ],
        "cStandard": "c17",
        "cppStandard": "gnu++14",
        "intelliSenseMode": "windows-gcc-x64",
        "compilerPath": "C:/TDM-GCC-64/bin/g++.exe"
    }
],
"version": 4

}

My source code :

#include <iostream>

#define ASIO_STANDALONE
#include <asio.hpp>


int main()
{
    return 0;
}

I don't have an idea what is wrong.

Any help is appreciate.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • 2
    JSON treats backslashes in strings specially. Use forward slashes instead when specifying an include path (`C:/Users/mines/.../include`). You should probably use an actual build system like Make or CMake if you start including external libraries though. – Botje Aug 07 '23 at 09:00
  • 1
    As mentioned in [the documentation](https://code.visualstudio.com/docs/cpp/config-mingw) building is handled by the `tasks.json` file. Have you configured it correctly (assuming you get an actual build error)? Or are you using some kind of "code runner" plugin? Then please disable that and use the tasks as in the documentation. – Some programmer dude Aug 07 '23 at 09:01
  • c_cpp_properties.json is the wrong file. tasks.json is where you specify header file locations for the compiler. VSCode is tricky, it's a good idea to read the documentation. – john Aug 07 '23 at 09:14

0 Answers0