Ubuntu 18.04 OS
Qt 5.12.5
Pure C++ application
When compiling an app done by others, I am experiencing over 1800 'multiple definition of ' errors.
After scouring the internet, I understand the ideas behind the error.
The problem is all the solutions to the error are already in place! and still the error occurred.
(#ifndef INCLUDED_A_H
#define INCLUDED_A_H
class A { };
#endif)
There was a suggestion of using the -c flag to cure the problem:
Your compilation rule is missing a -c flag:
%.o: %.cpp $(HEADERS)
g++ -std=c++11 $< -c -o $@
Without it, each source file will get compiled/linked into a complete executable rather than just stopping after the compilation step to create a simple object file. Your link step then tries to link those already-linked executables and crashes due to the multiple symbol declarations.
Please show me how to include the -c flag. I tried 'CONFIG += -c -o' in the .pro file to no effect.
Bookmarks