crow_all.h gives large number of errors when i compile my main.cpp file
mAhmedBappi opened this issue · comments
Platform: macOS Catalina 10.15.4.
g++ --version:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.29)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
main.cpp:
#include
#include "crow_all.h"
using namespace std;
int main(){
crow::SimpleApp app;
CROW_ROUTE(app, "/")({
return "Hello world";
});
app.port(3000).multithreaded().run();
}
command to compile:
g++ -o main main.cpp
There are alot of error massages and warnings shown by the compiler when i run the g++ command. Why is it giving these errors?
Could you fix formatting? What kind of errors? Did you include all needed libraries? Look at example CMake file (https://github.com/ipkn/crow/blob/master/examples/CMakeLists.txt).
Hey! The following error comes when i try to build the project using cmake.
what i did:
clone git repo,
cd crow
mkdir build
cd build
cmake ..
make
when i do the above i get the following error:
/Desktop/crow/include/crow/socket_adaptors.h:22:28: error: no
member named 'get_io_service' in
'boost::asio::basic_stream_socket<boost::asio::ip::tcp,
boost::asio::executor>'
return socket_.get_io_service();
Can you please tell the whole process from cloning the repo to building it to linking it to a project to running the "hello world" program in simple steps!
Probably you have newer Boost installed. Try building from my repo (https://github.com/mrozigor/crow) - patch is already applied there.
This looks like Mac specific problem -> https://stackoverflow.com/a/58719834/2568147
Possibly you can try to move line 17 (endif()
) to line 28 (after add_custom_target(example_ws_copy...
(https://github.com/mrozigor/crow/blob/master/examples/CMakeLists.txt). It shouldn't then build targets with dependencies to OpenSSL.