Gpp-compiler won't compile when using more than 1 file


#1

I’ve encountered problems when compiling C++ projects with MYCLASS.h and MYCLASS.cpp files.

When I run “c++ main.cpp MYCLASS.cpp” in the bash it works perfectly fine, but when I compile with the gpp-compiler package it doesn’t. I traced down the problem being the arguments being sent to the compiler is “main.cpp -o /tmp/main” instead of “main.cpp MYCLASS.cpp -o /tmp/main”.

What am I doing wrong that it won’t add my other file?


Error when I compile C++ project using class function
#2

Okay I just figured it out on my own.
1 Select main.cpp on the left and then add MYCLASS.cpp to the selection with strg+left click.
2 Right click on either one of them -> compile and run.

but there has to be an easier way, hasn’t it?


#3

For everyone who’s having the same problem better use something like this in the terminal from the project folder:

clear && c++ A_main.cpp MYCLASS.cpp -std=c++11 -o /tmp/a.out && /tmp/a.out