2

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

user1391863
  • 137
  • 3
  • 12

1 Answers1

1

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.

wiggily
  • 465
  • 4
  • 10