c++ – How to build a program that uses a third-party library


There is a program that consists of one .cpp file. It uses the libcurl library. You need to compile this case for embedded Linux on a Cortex A7 (arm 32-bit) processor.

As I understand it, you need to configure and then build the library for the desired architecture, and then build the program itself using a cross-platform compiler.

The problem is that I have no idea how to tell the compiler to #include understand that the library is somewhere near here.


how to indicate there so that #include understands that the library is somewhere nearby here

In fact, we are talking about the header file of the library (* .h)

-I. (includes are searched in the same folder as the compiled file)

so that the linker knows where the compiled library is located

the -L. (in the same folder)

so that when loading the library is searched in the same folder with the executable file

flags -Wl, -R,\$$ORIGIN

It's probably not enough to solve your specific problem, but these are the three standard methods to build and run something in one folder. Might be of some help.

Scroll to Top