Environment variable set in batch file cannot be accessed in the C code compiled by the file

时间:2018-03-25 18:43:26

标签: c windows batch-file

I'm setting a var using set TEST_VAR=5 and then I'm compiling a C code. Error found during compilation is TEST_VAR is an undeclared variable.

1 个答案:

答案 0 :(得分:2)

Wild-assed guess, because you don't even show a single line of C code: getenv(TEST_VAR) should be getenv("TEST_VAR").

PS: To avoid downvotes for your next question (and possibly unhelpful answers like mine), please read http://www.catb.org/esr/faqs/smart-questions.html explaining the art of asking smart questions.