I'm trying to compile an external program from c++ using system, but its not working. It says "Undefined reference to 'main'" even though I have a main function. I can compile the program from the terminal, but system and popen have the error. I don't know why its not working, any help is appreciated.