How to define project macro in Modus

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

cross mob
shiyouxue
Level 1
Level 1
10 questions asked First like given 5 replies posted

Dear Community

We are developing 3 Models in 1 product.
for convenience, I want to define a MACRO in the Modus IDE with common code for 3 models.
How to define MACRO in the Modus IDE.

For eg:
If revise the MACRO = MODEL_1,
We can compile the code which is in #if (MODEL == MODEL_1).
If revise the MACRO = MODEL_2,
We can compile the code which is in #if (MODEL == MODEL_2).
If revise the MACRO = MODEL_3,
We can compile the code which is in #if (MODEL == MODEL_3).

Best regards.

0 Likes
1 Solution
LeoMathews
Moderator
Moderator
Moderator
First question asked 500 replies posted 100 solutions authored

Hi @shiyouxue 

Since you have 3 models you can create a MACRO by defining it by:

#define MODEL "MODEL_1"

If the macro is refined as shown, it will execute the code which is in #if (MODEL == "MODEL_1")

For choosing MODEL_2 you can revise the macro by:

#define MODEL "MODEL_2"

Similarly, you can revise it for "MODEL_3"

Thanks and Regards,
Leo

View solution in original post

0 Likes
2 Replies
LeoMathews
Moderator
Moderator
Moderator
First question asked 500 replies posted 100 solutions authored

Hi @shiyouxue 

Since you have 3 models you can create a MACRO by defining it by:

#define MODEL "MODEL_1"

If the macro is refined as shown, it will execute the code which is in #if (MODEL == "MODEL_1")

For choosing MODEL_2 you can revise the macro by:

#define MODEL "MODEL_2"

Similarly, you can revise it for "MODEL_3"

Thanks and Regards,
Leo

0 Likes
LeoMathews
Moderator
Moderator
Moderator
First question asked 500 replies posted 100 solutions authored

Hi @shiyouxue ,

Thread was locked due to inactivity for long time, you can continue the discussion on the topic by opening a new thread with reference to the locked one. The continuous discussion in an inactive thread may mostly be unattended by community users.

Thanks and Regards,
Leo Mathews George

0 Likes