With Eclipse: How to add include paths and libraries for all your C/C++ project

后端 未结 8 1924
闹比i
闹比i 2020-12-17 09:33

Is it possible to add include paths and libraries to all C/C++ projects? In others words: How can I make them global or copy one C/C++ project build setting to another one?<

8条回答
  •  甜味超标
    2020-12-17 09:39

    I am looking into it long ago. A few posts mentioned one method: Project > Properties > C/C++ General > Paths and Symbols Then click Export Settings.. But it only works for including header files.

    To specify libraries and library paths, as far as I know, I do not find an easy solution. For example, I am now using ffmpeg libraries. If you use "Makefile", the including and library files can be expressed below:

    FFMPEG_LIBS= libavdevice
    libavformat
    libavfilter
    libavcodec
    libswresample
    libswscale
    libavutil
    CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS) LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)

    There are many files here. If I include them one by one in an Eclipse C++ project, it is daunting. I do not know why there is no option in Eclipse that we could include library files by using past a long line using ; as a separator, such as:

    -lavdevice -lavfilter -lswresample -lswscale -lavformat -lavcodec -ldl -lasound -lSDL -lz -lrt -lavutil -lm

    Is there any such way, or I have to type the library files one by one, or have to use Makefile?

提交回复
热议问题