Closed carl0529 closed 8 months ago
I would like to use the library in Codeblocks. I had follow build instruction successfully, and added "/usr/local/include" to Project build options > Search directories > Compiler. The compiler can link to the library and get some declared variables. But I cannot even run the sample codes due to "undefined reference". Is there any additional set-up required for using in Codeblocks?
There is a confusion here, finding the header allows the compiler to get the definitions but it is not sufficient to link the library itself. In addition to setting the include path for the compiler, you need to add the library you built to the linker (I guess in the "Linker" tab instead of "Compiler"). This is not specific to libdatachannel.
Yet, putting library path in Project build options > Search directories > Compiler is standard procedure. I have no problem setting-up in this way when using OpenCV libarary. In addition, it still fail to link even if I also add the path to Search directories > Linker.
Is there any flag required when using the library, such as -pthread, -lX11, pkg-config --flags --libs opencv4
placed after g++?
Is there any flag required when using the library, such as -pthread, -lX11,
pkg-config --flags --libs opencv4
placed after g++?
Yes, that's what I meant by adding the library, you need to add datachannel
(the g++ argument is -ldatachannel
).
Thanks, it work now. I thought the flag was -libdatachannel and kept getting it wrong.
I would like to use the library in Codeblocks. I had follow build instruction successfully, and added "/usr/local/include" to Project build options > Search directories > Compiler. The compiler can link to the library and get some declared variables. But I cannot even run the sample codes due to "undefined reference". Is there any additional set-up required for using in Codeblocks?