2

I'd like to compile and test Crow C++ microframework in Debian Linux 11:

  1. Download the latest crow.deb, currently crow-v1.0+1.deb.

  2. Install it:

    $ sudo dpkg -i crow-v1.0+1.deb
    Selecting previously unselected package crow.
    (Reading database ... 587955 files and directories currently installed.)
    Preparing to unpack crow-v1.0+1.deb ...
    Unpacking crow (1.0+1) ...
    Setting up crow (1.0+1) ...
    
  3. Create a .cpp file with a sample code from crowcpp.org:

    $ echo '#include "crow.h"
    
    int main()
    {
        crow::SimpleApp app;
    
        CROW_ROUTE(app, "/")([](){
            return "Hello world";
        });
    
        app.port(18080).run();
    }' > crowtest.cpp
    
  4. Try to compile it:

    $ g++ crowtest.cpp -lpthread
     In file included from /usr/include/crow.h:2,
                      from crowtest.cpp:1:
     /usr/include/crow/query_string.h:9:10: fatal error: boost/optional.hpp: No such file or directory
         9 | #include <boost/optional.hpp>
           |          ^~~~~~~~~~~~~~~~~~~~
     compilation terminated.
    
  5. See the error above. How can I compile the Crow sample code?

haba713
  • 2,465
  • 1
  • 24
  • 45

1 Answers1

5

You need to install Boost, for Debian that would be apt install libboost-dev.

  • Le lib is massive :S: > After this operation, **142 MB** of additional disk space will be used. – Édouard Lopez Nov 22 '22 at 10:09
  • I agree, boost is a massive library, most of which isn't being used in Crow. Which is why it was dropped in favor of standalone ASIO on the master branch. You can try that if storage is an issue :D – Farook Al-Sammarraie Nov 22 '22 at 10:14