how to add a global preinclude header file ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
OmEs_4437866
Level 1
Level 1
First like given

Please guide me in this issue, I want to add a global configuration file which is preincluded in every file.

0 Likes
1 Solution

Hello:

i didn't find an accurate global position for your question, but you can add below setting in your .mk file by referring below example.

ifneq ($(wildcard $(CURDIR)trace/$(RTOS)_trace.h),)

# Make sure to include this trace_macros.h first (to ensure the trace macros are defined accordingly)

GLOBAL_CFLAGS   += -include $(CURDIR)trace/$(RTOS)_trace.h

GLOBAL_CXXFLAGS += -include $(CURDIR)trace/$(RTOS)_trace.h

View solution in original post

6 Replies
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

hello:

if you are using 43xx module,  we have a include directory   \43xxx_Wi-Fi\include

you can put your global define head file here.

0 Likes

I am sorry my question was not to the point. I want a global configuration header file to be automatically included in each and every file in the project. In other words, I need to add global defines but rather than listing them in a makefile I would rather write them in a master config header file.

0 Likes

Sorry, I still can't understand the meaning,  we have global header file in the include directory , if you want to use the defines in the .h file, you need to include it, I do not know the file you are describing now.

0 Likes

Yes I understand, I want the compiler to include this global file within the compiler flags. I do not want to go and include this file in every source file in the project. I want the compiler to do this for me. There is a "-include" compiler option in gcc I want to use it but dont know where to add it in your makefiles.

0 Likes

Hello:

i didn't find an accurate global position for your question, but you can add below setting in your .mk file by referring below example.

ifneq ($(wildcard $(CURDIR)trace/$(RTOS)_trace.h),)

# Make sure to include this trace_macros.h first (to ensure the trace macros are defined accordingly)

GLOBAL_CFLAGS   += -include $(CURDIR)trace/$(RTOS)_trace.h

GLOBAL_CXXFLAGS += -include $(CURDIR)trace/$(RTOS)_trace.h

Thank you for your time.

0 Likes