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.

12th Aug 2017, 7:46 PM
Mohammadreza
Mohammadreza - avatar
2 ответов
+ 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.
13th Aug 2017, 4:33 PM
Mahdi Afshar
Mahdi Afshar - avatar
0
actually, I've run my codes in terminal many times but this time, the compiler doesn't recognize my headers ​and source files.
13th Aug 2017, 8:49 PM
Mohammadreza
Mohammadreza - avatar