Cannot compile multiple C++ files


#1

Hi all,
When trying to compile multiple C++ files ie headers and additional cpp files. I get this error “clang: error: cannot specify -o when generating multiple output files”. I am using the gcc-compiler. Whats weird is that it works fine on my Windows PC but using atom on my mac I would receive this error. Any help would be much appreciated.

Thanks!


#2

This error has nothing to do with Atom. It has to do with the command string that gpp-compiler is sending to the compiler. If this breaks the package on Mac, you should make a report on the GitHub repo. In either case, you can use a package like process-palette to customize the command string as needed. If you require help with the command line instructions, I recommend asking in a forum frequented by many people who use C/C++ regularly.

Are you using the exact same compiler on both computers?


#3

OK. I will give that a shot. Thanks!


#4

Yes I think you are right.

@ausroa Try to compile the C++ file from terminal first and see if the error is thrown by gcc-compiler or by gcc itself.

You can use something like

g++ filename -o filename.o

If you are using some additional C++ features add additional flags like std=c++14 etc.