Skip to content

Include missing headers for std::unique_ptr, std::rand(), std::srand()

Christopher Chavez requested to merge (removed):missing-headers into master

#include <memory> should be done before using std::unique_ptr; likewise #include <cstdlib> should be done before using std::rand() and std::srand(). Some compilers (e.g. Xcode clang 8.2.1 and earlier) emit errors if the headers are missing:

qca-2.3.4/src/qca_default.cpp:110:28: error: no member named 'rand' in namespace 'std'; did you mean simply 'rand'?
            buf[n] = (char)std::rand();
                           ^~~~~~~~~
                           rand
/usr/include/stdlib.h:159:6: note: 'rand' declared here
int      rand(void);
         ^
qca-2.3.4/src/qca_default.cpp:1256:14: error: no type named 'srand' in namespace 'std'
        std::srand(t);
        ~~~~~^
2 errors generated.

Merge request reports