Git Product home page Git Product logo

Comments (5)

yhirose avatar yhirose commented on May 18, 2024 1

@DJuego, thanks for the error report!

I just found the following stackoverflow post. (etr/libhttpserver#71 (comment))
It seems like it would be better to use getnameinfo since the function is supported on all platforms.
I'll give it a try when I have time this weekend.

from cpp-httplib.

DJuego avatar DJuego commented on May 18, 2024 1

Congrats! It works like a charm in x86_64-7.3.0-release-posix-seh-rt_v5-rev0 (MinGW with POSIX) and Visual Studio 2017, @yhirose

Thank you! Good work! I guess in the next days i am going to test it more thoroughly. :-)

In an anecdotal note I have problems with x86_64-7.3.0-release-win32-seh-rt_v5-rev0.

I had to add for building:

#ifdef MINGW_WIN32
#include "mingw.mutex.h"
#include "mingw.thread.h"
#else
#include <mutex>
#include <thread>
#endif

However the application crashed. Anyway, I do not think the problem is cpp-httplib. I have to investigate it more deeply. At the moment you can close the issue, Thanks again!

.

from cpp-httplib.

yhirose avatar yhirose commented on May 18, 2024

@DJuego, I made the change at issue-60 branch. When you have time, could you test the httplib.h on the branch with your MinGW? (I don't have the compiler.) Thanks!

from cpp-httplib.

DJuego avatar DJuego commented on May 18, 2024

Thank you for your effort, @yhirose ! :-)

Well I have changed the old folder cpp-httplib with the new folder cpp-httplib in my project:

I get (MinGW)

[...]
   from P:\Mis-Proyectos\Profesional\procesarpeticiones\src\main.cpp:5:
..\..\inc\cpp-httplib/httplib.h: In instantiation of 'socket_t httplib::detail::create_socket(const char*, int, Fn, int) [with Fn = httplib::Server::create_server_socket(const char*, int, int) const::<lambda(socket_t, addrinfo&)>; socket_t = long long unsigned int]':
..\..\inc\cpp-httplib/httplib.h:1582:24:   required from here
..\..\inc\cpp-httplib/httplib.h:552:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
        if (sock == -1) {
            ~~~~~^~~~~
..\..\inc\cpp-httplib/httplib.h: In instantiation of 'socket_t httplib::detail::create_socket(const char*, int, Fn, int) [with Fn = httplib::Client::create_client_socket() const::<lambda(socket_t, addrinfo&)>; socket_t = long long unsigned int]':
..\..\inc\cpp-httplib/httplib.h:1825:10:   required from here
..\..\inc\cpp-httplib/httplib.h:552:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
obj\Debug\src\main.o: In function `httplib::detail::read_content_with_length(httplib::Stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long long, std::function<void (unsigned long long, unsigned long long)>)':
P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_mingwcdb/../../inc/cpp-httplib/httplib.h:771: multiple definition of `httplib::detail::read_content_with_length(httplib::Stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long long, std::function<void (unsigned long long, unsigned long long)>)'
obj\Debug\src\GestorDePeticiones.o:P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_mingwcdb/../../inc/cpp-httplib/httplib.h:771: first defined here
obj\Debug\src\main.o: In function `httplib::detail::read_content_without_length(httplib::Stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_mingwcdb/../../inc/cpp-httplib/httplib.h:791: multiple definition of `httplib::detail::read_content_without_length(httplib::Stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
obj\Debug\src\GestorDePeticiones.o:P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_mingwcdb/../../inc/cpp-httplib/httplib.h:791: first defined here
obj\Debug\src\main.o: In function `httplib::detail::read_content_chunked(httplib::Stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_mingwcdb/../../inc/cpp-httplib/httplib.h:807: multiple definition of `httplib::detail::read_content_chunked(httplib::Stream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
obj\Debug\src\GestorDePeticiones.o:P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_mingwcdb/../../inc/cpp-httplib/httplib.h:807: first defined here
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 20 second(s))
7 error(s), 28 warning(s) (0 minute(s), 20 second(s))
 

And i get (Visual Studio 2017):


[...]
1>main.obj : error LNK2005: "bool __cdecl httplib::detail::read_content_chunked(class httplib::Stream &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?read_content_chunked@detail@httplib@@YA_NAEAVStream@2@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in GestorDePeticiones.obj
1>main.obj : error LNK2005: "bool __cdecl httplib::detail::read_content_with_length(class httplib::Stream &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,unsigned __int64,class std::function<void __cdecl(unsigned __int64,unsigned __int64)>)" (?read_content_with_length@detail@httplib@@YA_NAEAVStream@2@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_KV?$function@$$A6AX_K0@Z@5@@Z) already defined in GestorDePeticiones.obj
1>main.obj : error LNK2005: "bool __cdecl httplib::detail::read_content_without_length(class httplib::Stream &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?read_content_without_length@detail@httplib@@YA_NAEAVStream@2@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in GestorDePeticiones.obj
1>P:\Mis-Proyectos\Profesional\procesarpeticiones\prj\procesarpeticiones_msvc2017\x64\Debug\procesarpeticiones_msvc2017.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Done building project "procesarpeticiones_msvc2017.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


from cpp-httplib.

yhirose avatar yhirose commented on May 18, 2024

@DJuego, I forgot to include #59 and I fixed it just now...
Could you get the latest httpib.h on issue-60 branch, and test it again?

from cpp-httplib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.