0
Run C++ code on Linux
Hi guys, how can I run a C++ code with all of included headers and cpp files in Linux. I've written the headers, in which there are classes, and their related functions in separate files. For example, Maxwell.h is âthe header which contains Maxwell class, and in a separate cpp file Maxwell.cpp is written as the class constructor. I've written the code in visual studio and it worked fine, but in Linux it cannotâ make an executable file and reports many errors! Can anybody tell me what should I do? Thanks.
2 Answers
+ 1
you can use Linux terminal. in terminal type:
g++ 'drag and drop your c++ source in terminal' then press enter.
note that all of your header and class and sourcefiles must be in one folder.
after debugging, type in terminal:
./a.out then press enter.
0
actually, I've run my codes in terminal many times but this time, the compiler doesn't recognize my headers âand source files.