I'm trying to compile a program with gcc, but I keep getting an error that it can't find the files I've specified to include. My code (a simplified version of what I'm trying to do which highlights the issue):
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
}
I'm compiling with gcc, using:
gcc test.c -I~/gtk/inst/include/gtk-2.0
which gives me
test.c:1:21: error: gtk/gtk.h: No such file or directory
However,
ls ~/gtk/inst/include/gtk-2.0/gtk | grep gtk.h
returns
gtk.h
gtkcheckbutton.h
gtkcheckmenuitem.h
gtkshow.h
so I'm not sure where I'm messing up. My OS is Mac OSX 10.8.5, and GCC is version 4.2.1.
You should either:
-I ~/gtk/inst/include/gtk-2.0
-I /users/username/gtk/inst/include/gtk-2.0
$HOME
: -I $HOME/gtk/inst/include/gtk-2.0
Shell only does tilde expansion if the ~
is the first nonquoted character in a word. The way you've got it now, shell has no clue that this is trying to point to the users home directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.