g++ include all /usr/include recursively

前端 未结 3 1861
余生分开走
余生分开走 2020-12-17 17:36

I\'m trying to compile a simple program, with

#include 

The path to gtkmm.h is /usr/include/gtkmm-2.4/gt

3条回答
  •  我在风中等你
    2020-12-17 18:19

    I guess you are not using a makefile? The only thing that could be annoying is having to type the long -I option each time you compile your program. A makefile makes it a lot easier.

    For example, you could modify the hello world makefile from wikipedia to something like the following:

    INC=-I/usr/include/gtkmm-2.4/
    
    helloworld: helloworld.o
        g++ -o $@ $<
    
    helloworld.o: helloworld.c
        g++ $(INC) -c -o $@ $<
    
    .PHONY: clean
    
    clean:
        rm -f helloworld helloworld.o
    

提交回复
热议问题