All,
I'm trying to track down the cause, and any answer that will get these compiler notes from mucking up my build.
I'm using VS2015, warning level 3. Since these are 'notes', i'm not sure what i can do to hide them. As soon as i even include the they will start appearing, but i'm sure it's not limited to signals.
I'd appreciate any help in figuring out what this is all about.
1> c:\software\simulators\packages\boost.1.65.1.0\lib\native\include\boost\signals2\connection.hpp(55): note: see reference to class template instantiation 'boost::signals2::detail::garbage_collecting_lock<Mutex>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(54): note: see reference to class template instantiation 'boost::arg<9>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(53): note: see reference to class template instantiation 'boost::arg<8>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(52): note: see reference to class template instantiation 'boost::arg<7>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(51): note: see reference to class template instantiation 'boost::arg<6>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(50): note: see reference to class template instantiation 'boost::arg<5>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(49): note: see reference to class template instantiation 'boost::arg<4>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(48): note: see reference to class template instantiation 'boost::arg<3>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(47): note: see reference to class template instantiation 'boost::arg<2>' being compiled
1> c:\software\sims\packages\boost.1.65.1.0\lib\native\include\boost\bind\placeholders.hpp(46): note: see reference to class template instantiation 'boost::arg<1>' being compiled
c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory(102): warning C4996: 'std::uninitialized_copy::_Unchecked_iterators::_Deprecate': Call to 'std::uninitialized_copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
Related
I'm using emplace_back function in a cpp project in visual studio and it works correctly. Visual studio shows following definition for it:
void std::vector<std::string>::emplace_back<CHAR(&)[1]>(CHAR(&_Val)[1])
Then, I'm going to move my cpp project files to a MFC project and use them in a dialog based app. When I moved codes to MFC project, emplace_back definition has changed to:
void std::vector<std::string>::emplace_back<WCHAR(&)[1]>(WCHAR(&_Val)[1])
And it leads to C2664 Error in xmemory0 after build:
Error C2664
std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const std::basic_string<char, std::char_traits<char>, std::allocator<char>> &)':
cannot convert argument 1 from 'WCHAR [1]' to 'std::initializer_list<_Elem>'
And in output it says:
note: see reference to function template instantiation 'void std::vector<std::string,std::allocator<_Ty>>::emplace_back<WCHAR(&)[1]>(WCHAR (&)[1])' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
How can I deal with such problems? Is there any option in properties of Visual Studio Project to correct?
Thanks
I have a strange situation here. I am trying to use the Botan crypto library with VS2015 (because some other parts of the project use some heavy C++11 code which VS2013 is unable to compile) and I get a pretty long compilation error (see below).
After trying out various things, I came to the conclusion, that even if one of the botan headers is included in the compiled c++ source file, the compiler will throw the error below. Right now I have a single line in the file:
#include <botan/botan.h>
and this is the error I get:
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\xmemory0(876): error C2664: 'Botan::secure_allocator<_Newfirst>::secure_allocator(const Botan::secure_allocator<_Newfirst> &)': cannot convert
argument 1 from 'std::_Wrap_alloc<Botan::secure_allocator<Botan::byte>>' to 'const Botan::secure_allocator<_Newfirst> &'
with
[
_Newfirst=std::_Container_proxy
]
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\xmemory0(876): note: Reason: cannot convert from 'std::_Wrap_alloc<Botan::secure_allocator<Botan::byte>>' to 'const Botan::secure_allocator<_Ne
wfirst>'
with
[
_Newfirst=std::_Container_proxy
]
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\xmemory0(876): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(587): note: see reference to function template instantiation 'std::_Wrap_alloc<Botan::secure_allocator<_Newfirst>>::_Wrap_alloc<std::_Wr
ap_alloc<Botan::secure_allocator<Botan::byte>>>(_Other &) noexcept' being compiled
with
[
_Newfirst=std::_Container_proxy,
_Other=std::_Wrap_alloc<Botan::secure_allocator<Botan::byte>>
]
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(587): note: see reference to function template instantiation 'std::_Wrap_alloc<Botan::secure_allocator<_Newfirst>>::_Wrap_alloc<std::_Wr
ap_alloc<Botan::secure_allocator<Botan::byte>>>(_Other &) noexcept' being compiled
with
[
_Newfirst=std::_Container_proxy,
_Other=std::_Wrap_alloc<Botan::secure_allocator<Botan::byte>>
]
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(585): note: while compiling class template member function 'void std::_Vector_alloc<std::_Vec_base_types<_Ty,_Alloc>>::_Free_proxy(void)
'
with
[
_Ty=Botan::byte,
_Alloc=Botan::secure_allocator<Botan::byte>
]
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(552): note: see reference to function template instantiation 'void std::_Vector_alloc<std::_Vec_base_types<_Ty,_Alloc>>::_Free_proxy(voi
d)' being compiled
with
[
_Ty=Botan::byte,
_Alloc=Botan::secure_allocator<Botan::byte>
]
C:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE\vector(679): note: see reference to class template instantiation 'std::_Vector_alloc<std::_Vec_base_types<_Ty,_Alloc>>' being compiled
with
[
_Ty=Botan::byte,
_Alloc=Botan::secure_allocator<Botan::byte>
]
c:\Botan\include\botan-1.11\botan/rng.h(43): note: see reference to class template instantiation 'std::vector<Botan::byte,Botan::secure_allocator<Botan::byte>>' being compiled
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3.0\VC\bin\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
Since I was able to compile and run the botan tests, I have the feeling that I missed something, but I have no idea what. Does anyone has any experience with this?
(BTW: The same code compiles nicely with g++ 4.9)
Looking at the sources, it seems that Botan::secure_allocator doesn't provide a template constructor of the form
template<class U> secure_allocator(const secure_allocator<U>& other);
This is required by the Standard. In the current working draft, N4527, the relevant bits are in [17.6.3.5] Table 28 - Allocator requirements; also useful is the example in paragraph 9.
So, we can't blame the standard library implementation that comes with VC 14 for requiring this in order to compile. The error is on Botan's side in my opinion.
A quick fix is to add such a definition to Botan::secure_allocator:
template<class U> secure_allocator(const secure_allocator<U>&) BOTAN_NOEXCEPT { }
Since instantiations of this allocator template don't have any non-static data members, an empty body should be fine. However, I'm not familiar with the library, and we're talking about cryptography here, so, before using this to do any serious stuff, please confirm the change with the library authors.
Another possible workaround:
I've noticed that the code that calls the mixed-type constructor seems to only be enabled when iterator debugging is enabled, which happens by default in Debug mode.
Have you tried compiling in release mode? If my observations are correct, you won't get this error anymore, since the additional machinery for iterator debugging will be disabled.
To get the same behaviour in Debug mode, set the _ITERATOR_DEBUG_LEVEL macro to 0 globally.
Debug iterators can be useful to detect errors (as long as the performance hit doesn't affect you), so I wouldn't use this as a permanent fix, but it could be useful as a temporary workaround if you don't want to modify the Botan header file.
This could also explain why you were able to compile the tests: maybe they're compiled in release mode, or, anyway, with a combination of settings that disables iterator debugging?
I had installed armadillo library on window visual studio 2013. When i attempted to build the solution. The following build error occurred. Any help will be appreciated.
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------
1> Source.cpp
1>c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(787): error C4146: unary minus operator applied to unsigned type, result still unsigned
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1626) : see reference to function template instantiation 'bool arma::diskio::convert_naninf<eT>(eT &,const std::string &)' being compiled
1> with
1> [
1> eT=arma::u32
1> ]
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1652) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<arma::u32>(arma::Mat<arma::u32> &,std::istream &,std::string &)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1571) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<double>(arma::Mat<double> &,std::istream &,std::string &)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/Mat_meat.hpp(6553) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<double>(arma::Mat<double> &,const std::string &,std::string &)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/Mat_meat.hpp(6536) : while compiling class template member function 'bool arma::Mat<double>::load(const std::string,const arma::file_type,const bool)'
1> Source.cpp(50) : see reference to function template instantiation 'bool arma::Mat<double>::load(const std::string,const arma::file_type,const bool)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/typedef_mat_fixed.hpp(41) : see reference to class template instantiation 'arma::Mat<double>' being compiled
1>c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(794): error C4146: unary minus operator applied to unsigned type, result still unsigned
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Sorry that someone downvoted your question; it seems reasonable to me.
These are warnings, which in this particular case are harmless. You must have the option turned on to treat warnings as errors. Your options seem to be:
Turn off the option to treat warnings as errors.
Turn off that particular warning (project wide).
Turn off that particular warning whenever you #include <armadillo>.
Option 3 is probably best, especially if the warnings as errors option is company policy. Make sure to push and pop the warning options; see this MSDN page on warning pragmas. You could put the whole lot (pragmas and include) into a little header file, which is probably a good idea anyway since Visual Studio won't autocomplete #include <armadillo> (since it doesn't have a file extension).
In Visual C++, when a static assert is fired or there is a template error, doubly clicking on the error itself will take you to the actual template code and not the actual erroneous code that is trying to call it or instantiate it.
To see the code that instantiated it, you have to go to the output window and essentially trace the error by double clicking on the lines that contain a source file with the wordings see reference to XXXXXX being compiled with. This is all great, but when the templates are complex, it is terribly hard to find the source files in all the mess and double click on them. For example (I have changed the names so the error itself may not make sense, but this is usually what you get):
1>templateClass.h(390) : error C2079: 'STATIC_ASSERT'
1> with
1> [
1> __formal=0
1> ]
1> filename.h(390) : while compiling class template member function 'TestClass<T>::TestClass(void)'
1> with
1> [
1> T=s32
1> ]
1> anotherFilename.cpp(131) : see reference to class template instantiation 'TestClass<T>' being compiled
1> with
1> [
1> T=s32
1> ]
1> yetAnotherFileName.cpp(149) : see reference to function template instantiation 'void Test_TestClass<T>(void)' being compiled
1> with
1> [
1> T=some_policy_class
1> ]
So my question is this: Is there a shortcut to traverse the error stack (is that the right terminology?) for a single error? A shortcut similar to CTRL+SHIFT+F12, which is view next error. Would be great if there is a shortcut for view next file in error.
I am working on porting our C++ code from eVC 4.0 to Visual Studio 2008. Our target is Windows Mobile 6.1 and we are using the Windows Mobile 6.0 SDK for our app.
Our code used stl port when compiled in eVC 4 and we would like to continue to use stl port if at all possible.
Does anyone know what steps are necessary to incorporate STL port (5.2.1) in our application. We have set the include directories in the solution (as we did for the eVC 4.0 project), but we are seeing the errors (below) any time we try to use list push_back or vector insert commands with our own classes (below is the error with our class "TriangleBufferElement"). These commands do seem to work with native types like int, double, etc.
We have ensured all classes have the proper contructors, copy constructors, assignment operators, and comparison operators and all appear to be correct.
Any ideas?
C:\Program Files\Windows CE Tools\stlport\stl/_construct.h(119) : error C2665: 'operator new' : none of the 2 overloads could convert all the argument types
1> C:\Program Files\Windows Mobile 6 SDK\PocketPC\include\../../../Windows Mobile 6 SDK\PocketPC\Include\Armv4i/new(61): could be 'void *operator new(unsigned int,const std::nothrow_t &) throw()'
1> while trying to match the argument list '(unsigned int, TriangleBufferElement *)'
1> C:\Program Files\Windows CE Tools\stlport\stl/_construct.h(134) : see reference to function template instantiation 'void stlp_std::_Copy_Construct_aux<_Tp>(_Tp *,const _Tp &,const stlp_std::__false_type &)' being compiled
1> with
1> [
1> _Tp=TriangleBufferElement
1> ]
1> C:\Program Files\Windows CE Tools\stlport\stl/_vector.h(381) : see reference to function template instantiation 'void stlp_std::_Copy_Construct<_Tp>(_Tp *,const _Tp &)' being compiled
1> with
1> [
1> _Tp=TriangleBufferElement
1> ]
1> C:\Program Files\Windows CE Tools\stlport\stl/_vector.h(376) : while compiling class template member function 'void stlp_std::vector<_Tp>::push_back(const _Tp &)'
1> with
1> [
1> _Tp=TriangleBufferElement
1> ]
1> c:\srcdevbranch\pointlib\dtmconverter\dtm\dtmreader\.\trianglebuffer.h(47) : see reference to class template instantiation 'stlp_std::vector<_Tp>' being compiled
1> with
1> [
1> _Tp=TriangleBufferElement
1> ]
Some links you probably should see (if not seen already):
STLPort Notes:
You may experience problems with default SGI node allocator. I had no such problems, though. Default node allocator is quite fast, so I wouldn't recommend disabling it without serious reason. However, if it causes problems, define _STLP_USE_MALLOC or _STLP_USE_NEWALLOC to get bare malloc()-based or new()-based default allocator.
Though this post says it has not yet been ported to VS2008.
Have you reconfigured STLPort for the new compiler environment? Visual Studio 2008 is quite different from the old eVC++ compiler.
Try:
configure evc9
In my case, this was due to __PLACEMENT_NEW_INLINE defined