0

Let the laughs begin!(at least I told you)

Machine: Asus win10 ryzen 5800x w/ virtualization on

errors:

[7/5/2022, 9:51:02 PM] For C source files, IntelliSenseMode was changed from "windows-gcc-arm64" to "windows-gcc-x64" based on compiler args and querying compilerPath: "C:\msys64\mingw64\bin\gcc.exe"
[7/5/2022, 9:51:02 PM] IntelliSenseMode was changed because it didn't match the detected compiler.  Consider setting "compilerPath" instead.  Set "compilerPath" to "" to disable detection of system includes and defines.
[7/5/2022, 9:51:02 PM] For C++ source files, IntelliSenseMode was changed from "windows-gcc-arm64" to "windows-gcc-x64" based on compiler args and querying compilerPath: "C:\msys64\mingw64\bin\gcc.exe"
[7/5/2022, 9:51:02 PM] IntelliSenseMode was changed because it didn't match the detected compiler.  Consider setting "compilerPath" instead.  Set "compilerPath" to "" to disable detection of system includes and defines.

Compile CMD win10: g++ .\http_example.cpp -o http_example // note in pwd 

Code taken for web:

How to send http request and retrieve a json response C++ Boost

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

int main() {
    boost::system::error_code ec;
    using namespace boost::asio;

    // what we need
    io_service svc;
    ip::tcp::socket sock(svc);
    sock.connect({ {}, 8087 }); // http://localhost:8087 for testing

    // send request
    std::string request("GET /newGame?name=david HTTP/1.1\r\n\r\n");
    sock.send(buffer(request));

    // read response
    std::string response;

    do {
        char buf[1024];
        size_t bytes_transferred = sock.receive(buffer(buf), {}, ec);
        if (!ec) response.append(buf, buf + bytes_transferred);
    } while (!ec);

    // print and exit
    std::cout << "Response received: '" << response << "'\n";
}

Installed mingw-w64-x86_64-boost using: MYSY2 MYSY; pacman -S mingw-w64-x86_64-boost

Any Suggestions on the issue/error?

5pyD3R
  • 3
  • 1
kcash
  • 1
  • 2
  • 2
    We don't laugh. That would be rude. We do vote, though. This looks like a question about Visual Studio or Visual Studio Code. You should add the `visual-studio` or `visual-studio-code` tag to catch the attention of the appropriate IDE's gurus. They'll be more useful here than the general C++ and GCC folks. – user4581301 Jul 06 '22 at 04:03
  • Are those really errors? I don't understand what is going wrong. Please elaborate. Also, please try compiling directly from command line rather than from an IDE. – kiner_shah Jul 06 '22 at 06:52
  • 1: AppData\Local\Temp\ccKZsSdJ.o:http_example.c:(.text$_ZN5boost4asio6detail17winsock_init_base7startupERNS2_4dataEhh[_ZN5boost4asio6detail17winsock_init_base7startupERNS2_4dataEhh]+0x74): undefined reference to `__imp_WSAStartup' 2: \AppData\Local\Temp\ccKZsSdJ.o:http_example.c:(.text$_ZN5boost4asio6detail10socket_ops5closeEyRhbRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops5closeEyRhbRNS_6system10error_codeE]+0xaa): undefined reference to `__imp_closesocket' (This straight off the command line using g++ ) – kcash Jul 07 '22 at 01:09

0 Answers0