Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anonymous namespace issue #576

Closed
amigo421 opened this issue Jan 20, 2016 · 7 comments
Closed

anonymous namespace issue #576

amigo421 opened this issue Jan 20, 2016 · 7 comments

Comments

@amigo421
Copy link
Contributor

amigo421 commented Jan 20, 2016

(not sure that is a problem of the lib).
I was writing an own project with a lot of headers (with logic) and added TEST_CASEs into each one. and was debugging/testing these ones individually. But after merging all headers into one project I faced with a number of similar issue which refer to TEST_CASE declaration in various modules in my project
(just for sure, my code works as designed and removing a part of TEST_CASEs solve the problem ), I'm also confirming that all TEST_CASEs compiled and work correctly in case of including into the project without other headers (looks like a conflict). the errors looks like these ones:

c:\dev\workspace\algolist\src\algolist.hpp(143): error C2374: '`anonymous-namespace'::autoRegistrar143': redefinition; multiple initialization
c:\dev\workspace\algolist\src\mfactory.hpp(143): note: see declaration of '`anonymous-namespace'::autoRegistrar143'
c:\dev\workspace\algolist\src\algolist.hpp(143): error C2084: function 'void ____C_A_T_C_H____T_E_S_T____143(void)' already has a body
c:\dev\workspace\algolist\src\mfactory.hpp(143): note: see previous definition of '____C_A_T_C_H____T_E_S_T____143'
@miklelappo
Copy link

#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( FILE, static_caststd::size_t( LINE ) )

@miklelappo
Copy link

The unique name don't have to use line number, otherwise when including other files you'll get this error

@horenmar
Copy link
Member

horenmar commented Jan 30, 2017

If possible (the compiler supports it), we now use __COUNTER__ to generate the unique name. Can you please check whether current single-include release still causes this error for you?

@horenmar horenmar added the Resolved - pending review Issue waiting for feedback from the original author label Jan 30, 2017
@horenmar horenmar closed this as completed Mar 3, 2017
@horenmar horenmar removed the Resolved - pending review Issue waiting for feedback from the original author label Mar 3, 2017
@amigo421
Copy link
Contributor Author

amigo421 commented Mar 3, 2017

hi mate,
is the problem still actual?
from those times, I changed my style and now never write a tests in the same header with a logic.
so that is a no issue for me yet, but I can try to do this , just to assist with a testing

@horenmar
Copy link
Member

horenmar commented Mar 3, 2017

@amigo421 It should be fixed, but testing is always welcome.

@philsquared
Copy link
Collaborator

Any feedback would be welcome. However please note that it does depend on whether we detect compiler support for __COUNTER__.

@amigo421
Copy link
Contributor Author

amigo421 commented Mar 3, 2017

if you treat this as solved, I won't test this right now , just will report this in case Iwill have faced with this again (i'm mostly using vc++ which supports __COUNTER__)

p.s. congrats-glad to see that you now work with jetbrains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants