Fix 'using namespace tracy' at global scope in a header file#1692
Fix 'using namespace tracy' at global scope in a header file#1692Vic-Min wants to merge 1 commit intovsg-dev:masterfrom
Conversation
|
By putting the using namespace tracy inside the vsg scope, the namespace becomes vsg::tracy, which is not what is intended. What platform are you working on? What version of tracy? Does the vsgtracyinstrumentation example compile for you? |
This is not true, the namespace does not become vsg::tracy:
Win10, VS2022
Last release 0.13.1
The I proposed this solution as a minimal one that solves the problem. |
|
I have just updated my old tracy checkout to 0.13.1 and the library compiles fine but the profiler is broken due to a new Wayland dependency. I'd guess my Kubuntu 24.04 systems Wayland libs are older than the latest Tracy is built against. Arrgg what a pain. In generally I prefer not using using namespace in headers, when I originally wrote the VSG tracy support I followed 3rd party examples and Tracy itself for inspiration. That was a while back and haven't touched it much since. |
|
To test I added: struct Color{};
Color color;to vsgtracyinstrumentation and then commented out the using namespace tracy and fixed build issues by putting in explict tracy:: in the TracyInstrumentation.h header. With these changes the above compiles in vsgtracyinstrumentation: 24f21da I will close this PR as VSG master should now work fine for you. |
Type of change
How Has This Been Tested?
error C2872: Color: ambiguous symbol can be "Color" or "tracy::Color"Checklist: