I have a program parsing some required options, some optional options, and I'm trying to also check if some flags are set. From what I understand, I need to:
- initialise a bool like
bool testBool = false
- add option to parser like
| lyra::opt(testBool)["-t"]["--testbool"]("Test bool");
After this, I can then parse argc and argv, and check for testBool being passed like if (testBool) { std::cout << "TestBool = y" << std::endl; }
However, if I have any bools in my lyra arg parser, my program seems to work fine until my main function returns, after which I get
free(): invalid pointer
Aborted: core dumped
if I pass -t to my executable.
Does anyone else experience this issue? (There is a decent chance that this is not actually a problem with lyra itself, but maybe a problem with my c++ skills, I am very new to this lang)
I have a program parsing some required options, some optional options, and I'm trying to also check if some flags are set. From what I understand, I need to:
bool testBool = false| lyra::opt(testBool)["-t"]["--testbool"]("Test bool");After this, I can then parse argc and argv, and check for testBool being passed like
if (testBool) { std::cout << "TestBool = y" << std::endl; }However, if I have any bools in my lyra arg parser, my program seems to work fine until my main function returns, after which I get
if I pass -t to my executable.
Does anyone else experience this issue? (There is a decent chance that this is not actually a problem with lyra itself, but maybe a problem with my c++ skills, I am very new to this lang)