Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive the following errors when trying to include #19

Closed
BrettKern opened this issue Mar 19, 2020 · 7 comments
Closed

Receive the following errors when trying to include #19

BrettKern opened this issue Mar 19, 2020 · 7 comments

Comments

@BrettKern
Copy link

HTTPRequest.hpp: In member function 'http::Response http::Request::send(const string&, const string&, const std::vector<std::__cxx11::basic_string >&)':
HTTPRequest.hpp:398:72: error: 'getaddrinfo' was not declared in this scope
if (getaddrinfo(domain.c_str(), port.c_str(), &hints, &info) != 0)
^
HTTPRequest.hpp:401:49: error: 'freeaddrinfo' was not declared in this scope
std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> addressInfo(info, freeaddrinfo);
^~~~~~~~~~~~
HTTPRequest.hpp:401:62: error: template argument 2 is invalid
std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> addressInfo(info, freeaddrinfo);
^
HTTPRequest.hpp:401:94: error: expression list treated as compound expression in initializer [-fpermissive]
std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> addressInfo(info, freeaddrinfo);
^
HTTPRequest.hpp:406:46: error: base operand of '->' is not a pointer
if (::connect(socket, addressInfo->ai_addr, static_cast<socklen_t>(addressInfo->ai_addrlen)) < 0)
^~
HTTPRequest.hpp:406:91: error: base operand of '->' is not a pointer
if (::connect(socket, addressInfo->ai_addr, static_cast<socklen_t>(addressInfo->ai_addrlen)) < 0)

@quantumcore
Copy link

Same error over here.

HTTPRequest.hpp: In member function 'http::Response http::Request::send(const string&, const string&, const std::vector<std::__cxx11::basic_string<char> >&)':
HTTPRequest.hpp:398:72: error: 'getaddrinfo' was not declared in this scope    
             if (getaddrinfo(domain.c_str(), port.c_str(), &hints, &info) != 0)
                                                                        ^
HTTPRequest.hpp:401:49: error: 'freeaddrinfo' was not declared in this scope
             std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> addressInfo(info, freeaddrinfo);
                                                 ^~~~~~~~~~~~
HTTPRequest.hpp:401:62: error: template argument 2 is invalid
             std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> addressInfo(info, freeaddrinfo);
                                                              ^
HTTPRequest.hpp:401:94: error: expression list treated as compound expression in initializer [-fpermissive]
             std::unique_ptr<addrinfo, decltype(&freeaddrinfo)> addressInfo(info, freeaddrinfo);
                                                                                              ^
HTTPRequest.hpp:406:46: error: base operand of '->' is not a pointer
             if (::connect(socket, addressInfo->ai_addr, static_cast<socklen_t>(addressInfo->ai_addrlen)) < 0)
                                              ^~
HTTPRequest.hpp:406:91: error: base operand of '->' is not a pointer
             if (::connect(socket, addressInfo->ai_addr, static_cast<socklen_t>(addressInfo->ai_addrlen)) < 0)
                                                                                           ^~

@elnormous
Copy link
Owner

What compiler/OS/WindowsSDK/C++ version you use?

@quantumcore
Copy link

@elnormous I'm using GCC, C++11.

@elnormous
Copy link
Owner

I can not reproduce this with any version of gcc. What version of gcc are you using? What operating system?

@quantumcore
Copy link

quantumcore commented Mar 27, 2020

GCC version 6.3.0, Operating System Windows.
Compiled : g++ main.cpp

@elnormous
Copy link
Owner

Are you using cygwin on mingw?

@elnormous
Copy link
Owner

Ok, this is a problem with MinGW. Fixed it in 14b3beb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants