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

warning C4275: non dll-interface class #66

Open
GoogleCodeExporter opened this issue Mar 12, 2015 · 6 comments
Open

warning C4275: non dll-interface class #66

GoogleCodeExporter opened this issue Mar 12, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

When I am statically linking the template library into my library, it always 
gives the warning:
 warning C4275: non dll-interface class 'std::_Container_base_secure' used as base for dll-interface class 'std::_Container_base_aux_alloc_empty<_Alloc>'

d:\program files\microsoft visual studio 9.0\vc\include\vector(439) : warning 
C4275: non dll-interface class 'std::_Container_base_secure' used as base for 
dll-interface class 'std::_Container_base_aux_alloc_empty<_Alloc>'
        with
        [
            _Alloc=std::allocator<std::string>
        ]
        d:\program files\microsoft visual studio 9.0\vc\include\xutility(93) : see declaration of 'std::_Container_base_secure'
        e:\ciscosoft\stb_studio\studio_tool\branches\srcgen\ctemplate\windows\ctemplate\template_cache.h(60) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
        with
        [
            _Ty=std::string
        ]
e:\ciscosoft\stb_studio\studio_tool\branches\srcgen\ctemplate\windows\ctemplate\
template.h(382) : warning C4251: 'ctemplate::Template::original_filename_' : 
class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be 
used by clients of class 'ctemplate::Template'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
e:\ciscosoft\stb_studio\studio_tool\branches\srcgen\ctemplate\windows\ctemplate\
template.h(384) : warning C4251: 'ctemplate::Template::resolved_filename_' : 
class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be 
used by clients of class 'ctemplate::Template'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]


how to solve this problem ?
Thank you.

Original issue reported on code.google.com by [email protected] on 29 Dec 2010 at 3:46

@GoogleCodeExporter
Copy link
Author

Sorry for the tardy reply; for some reason I didn't get any mail when this 
issue was filed, so I just saw it now.

I don't know anything about static linking, and only the bare minimum about dll 
interfaces (the less I know, the happier I am ;-) ).  I imagine I'm doing a 
dllexport() or something, when I shouldn't be because it's a static library?  
How are you making the static lib?

If you can figure out a fix for this, I'm happy to put it in the next release.  
However, I'm making a new release today (which is how I happened to notice this 
issue finally), so it will be a little while before the next one.

Original comment by [email protected] on 25 Jan 2011 at 12:22

  • Added labels: Type-Defect, Priority-Medium

@GoogleCodeExporter
Copy link
Author

It's been a while and I haven't heard any more from this.  I'm going to close 
the bug.  Feel free to reopen if you have more information.

Original comment by [email protected] on 26 Aug 2011 at 1:30

  • Changed state: WontFix

@GoogleCodeExporter
Copy link
Author

I think the problem is here?

http://code.google.com/p/google-ctemplate/source/browse/trunk/src/windows/ctempl
ate/template_cache.h

In this file, even when CTEMPLATE_DLL_DECL is defined to be empty, 
__declspec(dllexport) gets used.

Original comment by [email protected] on 16 Dec 2011 at 9:32

@GoogleCodeExporter
Copy link
Author

Hmm, that's plausible.  I'm seeing more of these errors in the new release I'm 
preparing and would love to figure out how to suppress them (without having to 
understand any of it, since it seems like a rathole...)

What's the right fix here?  I guess we just do nothing if CTEMPLATE_DLL_DECL is 
defined but empty?  I'm afraid that's probably not possible via the 
preprocessor, though maybe it is.

Original comment by [email protected] on 17 Dec 2011 at 12:12

  • Changed state: New

@GoogleCodeExporter
Copy link
Author

Please see my comment on issue 85:
http://code.google.com/p/ctemplate/issues/detail?id=85#c10

Original comment by [email protected] on 4 Jun 2012 at 5:19

@GoogleCodeExporter
Copy link
Author

Compiling v2.2 with visual studio 2012 I have encountered the same warning: 
1>D:\Projects\ctemplate-2.2\src\ctemplate/template.h(388): warning C4251: 
'ctemplate::Template::resolved_filename_' : class 
'std::basic_string<_Elem,_Traits,_Alloc>' needs to have dll-interface to be 
used by clients of class 'ctemplate::Template'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]

The following code in template.h fixed it:

template class __declspec(dllexport) std::basic_string<char, 
                                                       std::char_traits<char>, 
                                                       std::allocator<char> >;


Original comment by [email protected] on 11 Aug 2013 at 9:37

Attachments:

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

No branches or pull requests

1 participant