Open ctigrisht opened 1 year ago
Hi!
Can you provide a description how to reproduce your problem?
Hi!
Can you provide a description how to reproduce your problem?
Hey,
I created a windows only C++ project in VS 2022.
I tried installing from vcpkg first, using vcpkg install restinio
, it gave the the error so I just cloned source code and put it inside 'Libraries' folder and included all.hpp
.
I then create some code in main:
// other includes
#include "Libraries/restinio/all.hpp"
int main()
{
auto port = 5690;
auto address = "localhost";
restinio::run(
restinio::on_thread_pool(2)
.port(port)
.address(address)
.request_handler([](auto req) {
return req->create_response().set_body("Hello, World!").done();
})
);
return 0;
}
The above code works fine with Microsoft compiler, but not clang. No errors in the code tho, only his lld-link
EDIT: It doesn't work with any CLang C++ version, not just 20
Thanks for an explanation.
RESTinio itself is a header-only project, but it requires at least one dependency that should be compiled and then linked to the resulting executable: http_parser. fmtlib can be used as a header only or as a compiled library.
I suppose that when you build your example by using VC++ then some pragma lib
in http_parser/fmtlib are taken into the account by the compiler/linker. In the case of clang you have to add http_parser and fmtlib to your project.
add http_parser and fmtlib to your project
Do you mean link it within clang or embed it as source?
I mean that you have to compile and link http_parser. You can do it as a separate library or by including its source into your project.
BTW, you can found more information about building RESTinio here: https://stiffstream.com/en/docs/restinio/0.6/obtaining.html#build
PS. I don't use VisualStudio and don't know how to use VisualStudio projects. I hope VisualStudio supports CMakeLists.txt files.
I am trying to use this in a CLang C++ 20 in visual studio 2022 project and I get errors, it works fine with Microsoft's compiler