How do I add a directory to C header include path?

后端 未结 2 1918
悲&欢浪女
悲&欢浪女 2020-12-01 13:31

I am having trouble installing a dependency for a program that itself depends on pcre.h. I have this installed to /opt/local/include, but the C compiler does not see it and

相关标签:
2条回答
  • 2020-12-01 13:48

    Use -I /opt/local/include on the command line or C_INCLUDE_PATH=/opt/local/include in the environment.

    0 讨论(0)
  • 2020-12-01 13:50

    Use the pcre-config utility to get the right flags:

    $ pcre-config --libs --cflags
    -L/opt/local/lib -lpcre
    -I/opt/local/include
    

    If you're compiling via the command line,

    $ gcc -Wall -g `pcre-config --libs --cflags` main.c
    
    0 讨论(0)
提交回复
热议问题