#define CROW_MAIN
, unfortunately following CrowCpp/Crow#110 which originally described the problem seems to compile just fine. any ideas?
#define CROW_MAIN
with my PR. What exactly are you trying to test? I"ve tested inclusion in multiple source files and I've tested putting the crow include inside a header which itself is included in multiple source files (which basically is the same thirg as the first one) and both worked.
// test.hpp
#pragma once
#include <crow.h>
#include <string>
inline static void start_crow_server(unsigned int port) {
crow::SimpleApp app;
CROW_ROUTE(app, "/")
([port]() { return "Hello World " + std::to_string(port); });
app.port(port).multithreaded().run();
}
void test();
// a.cpp
#include <test.hpp>
#include <thread>
int main(int argc, char** argv) {
std::thread t([]() { test(); });
start_crow_server(8002);
t.join();
return 0;
}
// b.cpp
#include <test.hpp>
void test() {
start_crow_server(8001);
}
#define CROW_MAIN
inside the header (as expected) or leave it out (as expected). Only if I put it in one cpp file and one only it works (as expected).master
rather than a version number (e.g. blueprints.md
and routes.md
), once a release is made the idea is to change those to the version number. This is because I don't want people to be confused by a v0.4
in the doc when it doesn't actually exist anywhere else
## Disclaimer
region?
https://
leading to broken webpages (at least for me).
//if there is a redirection with a partial URL, treat the URL as a route.
std::string location = res.get_header_value("Location");
if (!location.empty() && location.find("://", 0) == std::string::npos)
{
#ifdef CROW_ENABLE_SSL
location.insert(0, "https://" + req_.get_header_value("Host"));
#else
location.insert(0, "http://" + req_.get_header_value("Host"));
#endif
res.set_header("location", location);
}