ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.43k stars 889 forks source link

crow_all.h gives large number of errors when i compile my main.cpp file #382

Open mAhmedBappi opened 4 years ago

mAhmedBappi commented 4 years ago

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?

mrozigor commented 4 years ago

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).

mAhmedBappi commented 4 years ago

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_streamsocket<boost::asio::ip::tcp, boost::asio::executor>' return socket.get_io_service();

mAhmedBappi commented 4 years ago

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!

mrozigor commented 4 years ago

Probably you have newer Boost installed. Try building from my repo (https://github.com/mrozigor/crow) - patch is already applied there.

mAhmedBappi commented 4 years ago

did the same process as described above using your repo. The following error occured:

Screenshot 2020-07-11 at 8 58 15 AM
mrozigor commented 4 years ago

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.