I am trying to compile a code written in C (ndpiReader.c program that comes with nDPI library, hosted here). I'm using Qt Creator and GCC compiler.
After doing some research here and here, I notice that compiling C code with C++ compiler is not the best idea. But I didn't get the answer of how to do this conversion and make this code C++ compatible.
When I try to run the code in Qt Creator I get the error bellow:
error: invalid conversion from 'void*' to 'ndpi_flow_struct*' [-fpermissive] if((newflow->ndpi_flow = malloc_wrapper(size_flow_struct)) == NULL) { ^
If more info is needed to solve the problem please leave a comment. I'm new to C++ so detailed answers with links are so much appreciated.
Edit: here is malloc_wrapper()
function's code
static void *malloc_wrapper(unsigned long size) {
current_ndpi_memory += size;
if(current_ndpi_memory > max_ndpi_memory)
max_ndpi_memory = current_ndpi_memory;
return malloc(size);
}