gcc 4.4.5 c89
I recently downloaded and installed log4c on my development machine.
I put all the headers and includes in the following directories.
project_name/tools/log4c/inc
project_name/tools/log4c/libs
However, as I installed the headers where in the system path:
/usr/include/log4c/*.h
So in my project, when I was including layout.h. layout.h would include the following header in this system path.
#include <log4c/logging_event.h>
I created the same directory structure on the target machine as I did for my development for tools/inc and tools/lib.
However, it wouldn’t compile because I hadn’t installed the log4c on the target machine so the system path for log4c didn’t exist. However, the user of the target machine will not be expected to install log4c. Everything should work out of the box.
So what I think is a good idea is to edit all the headers. from this:
#include <log4c/logging_event.h>
to
#include "logging_event.h"
All the headers are in the inc directory, so I won’t be using the system path.
My question is this a good idea to put all the headers into a single directory and edit them to point to this single inc directory?
Many thanks for any advice,
I’d leave the headers alone — changing them is potentially error-prone and time-consuming, especially if you want to update your version of log4c at some point.
Am I understanding right that the same headers that are in
/usr/include/log4care also in yourproject_name/tools/log4c/incdirectory? If so, move them toproject_name/tools/log4c/inc/log4c, and add an include path to yourgcccommand line using the-Iflag:We’re moving the files to
log4c/inc/log4cso that<log4c/logging_event.h>can still match on thelog4cdirectory underlog4c/inc/.EDIT: I originally typoed
-Las the flag, which sets library search paths rather than include file search paths.-Iis the correct flag for this case.