preprocessor

23 views
Skip to first unread message

Shawn Riordan

unread,
Oct 5, 2020, 2:21:11 PM10/5/20
to emscripten-discuss
If I wanted my code to have a custom preprocessor definition, how do I pass that on the emcc commandline?

Lets say I want my C++ code to have something like:

#ifdef FOO
    printf("foo");
#endif

how do I set the value of FOO when I run emcc?

Shawn Riordan

unread,
Oct 5, 2020, 2:47:09 PM10/5/20
to emscripten-discuss
Would it be "-D"?

As in, to enable foo:
em++ -D FOO=1
to disable foo
em++ -D FOO=0

?

Shawn Riordan

unread,
Oct 5, 2020, 11:32:30 PM10/5/20
to emscripten-discuss
BTW, this seems to be correct.
Reply all
Reply to author
Forward
0 new messages