c++ undefined reference error, even after adding -I and -L in the compilation step

Viewed 21

I have created a small demo:

#include<stdlib.h>
#include<ff_api.h>

using namespace std;

int main(int argc, char** argv) {
    ff_init(argc, argv);
    return 0;
}

But now when I compile it, I get this error:

g++ -I /usr/local/include -L /tmp/data/f-stack/lib demo.cpp -o demo -lm

I have checked the header file is present in /usr/local/include and the .cpp and .o files are present in /tmp/data/f-stack/lib

I get error:

/tmp/ccctpkSf.o: In function `main':
demo.cpp:(.text+0x1c): undefined reference to `ff_init'
collect2: error: ld returned 1 exit status

I know this is a trivial question, but can anyone help here?

0 Answers
Related