I have several projects under the same solution . I want to add this to all my .rc files:
#define STR(x) #x
#define STRING(x) STR(x)
#define TESTER STRING(MACRO1.MACRO2)
MACRO1 = 9
MACRO2 = 10
these are two macros that I added at the property pages using : "User Macros"
I thought using the same "User macros" but how can I declare macro with a parameter input there? I also thought using header files but still it's duplication..
Is there a way to define these STR and STRING in common properties? or somehow just for my projects to read them ? Instead of adding the same code to all my sources?
thanks
You could create a header file containing all the global data and put it in solution directory. Then add this file to your solution as an existing item. For example defines.h
:
#pragma once
#define STR(x) #x
#define STRING(x) STR(x)
#define TESTER STRING(MACRO1.MACRO2)
MACRO1 = 9
MACRO2 = 10
You can address this header with a relative address anywhere needed like this (assuming you have a folder for each project):
#include "../defines.h"
Or you could just add the address to your Additional Include Files in project.
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.