tohava
tohava

Reputation: 5412

GCC - error for different classes with the same name

Let's say I have two files:

a.cpp

class C { int x; };

b.cpp

class C { string s; };

I want to get an error about this during my build process. What should I do? (I don't mind using some external tool).

Upvotes: 1

Views: 77

Answers (1)

Alon
Alon

Reputation: 1804

This falls under the fact that each c/cpp file is a compilation unit, separated from each, if you really want to verify this doesn't happen, you can objdump the *.o files generated by the compiler, parse them with some script, and see that non correlate.

Upvotes: 1

Related Questions