# Failed to build an application



## notooth (Aug 24, 2020)

Hello,

I failed to build an application from source. Can anyone help?


```
$ make
x11_clipboard.c:21:10: fatal error: 'X11/Xlib.h' file not found
*** Error code 2


$ make CXXFLAGS='-I/usr/local/include'
x11_clipboard.c:21:10: fatal error: 'X11/Xlib.h' file not found
*** Error code 2
```


----------



## SirDice (Aug 24, 2020)

Are you sure it's C++ (CXXFLAGS is for C++)? You probably need to set CFLAGS. But you really should fix this in the Makefile.


----------



## George (Aug 24, 2020)

Do you have the file /usr/local/include/X11/Xlib.h?

Otherwise you need to find the port that installs it.


----------



## notooth (Aug 24, 2020)

Yes, I have the file /usr/local/include/X11/Xlib.h. I added CFLAGS='-I/usr/local/include' in Makefile, and it still give the same error.


----------



## Paul Floyd (Aug 27, 2020)

Strictly speaking, there are the 4 following make variables

CFLAGS for flags related to C compilation (e.g., -Wstrict-prototypes)
CXXFLAGS for flags related to C++ compilation (e.g., -fno-rtti)
CPPFLAGS for flags related to the preprocessor ofr both C and C++ compilation (e.g., -D and -I)
LDFLAGS for flags related to the linker driver (e.g., -L)

Can you show what compilation command make is running? And the corresponding rule from the makefile?


----------



## Deleted member 63539 (Aug 27, 2020)

notooth said:


> Hello,
> 
> I failed to build an application from source. Can anyone help?
> 
> ...


Is there any configure script or just the makefile alone?


----------

