#include <iostream>
#include <vector>
#define _SET_ENV_VAL_(F,v) set_##F##Env(v)
void setAAAEnv(int val) {
    
}
void setBBBEnv(int val) {
    
}
void setCCCEnv(int val) {
    
}
int main() {
    // Write C++ code here
    std::cout << "Hello world!";
    std::vector<std::string> funcs {"AAA", "BBB", "CCC"};
    
    for(auto iter:funcs) {
        _SET_ENV_VAL_(iter, 1);
    }
    
    
    return 0;
}
I want to use the macro function "SET_ENV_VAL" to concate the function name, but I get some compile errors like below.
/tmp/gjdChSSJ2K.cpp:4:41: error: ‘set_iterEnv’ was not declared in this scope 4 | #define WX_SET_ENV_VAL(F,v) set_##F##Env(v) | ^~~~ /tmp/gjdChSSJ2K.cpp:21:9: note: in expansion of macro ‘WX_SET_ENV_VAL’ 21 | WX_SET_ENV_VAL(iter, 1); |
How to fix this error and make the macro function working as expected?
 
    