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).
Related
I'm compiling a very old codebase under Visual Studio 2017. The code compiles, but the compiler is emitting the following messages, which I don't know how to interpret.
EDIT: Here's the unaltered compiler output
1>------ Build started: Project: Obsidian.DSP.DirectShow, Configuration: Debug x64 ------
1>clock.cpp
1>parsing with MACROS
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(962): warning C4101: 'rtDelta': unreferenced local variable
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(1277): warning C4101: 'rtGetTime': unreferenced local variable
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(286): warning C4101: 'pHead': unreferenced local variable
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(282): note: while compiling class template member function 'void CTClockSubordinate<LONGLONG,LONGLONG>::OnMasterTime(MasterClock)'
1> with
1> [
1> MasterClock=LONGLONG
1> ]
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(1566): note: see reference to function template instantiation 'void CTClockSubordinate<LONGLONG,LONGLONG>::OnMasterTime(MasterClock)' being compiled
1> with
1> [
1> MasterClock=LONGLONG
1> ]
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.h(410): note: see reference to class template instantiation 'CTClockSubordinate<LONGLONG,LONGLONG>' being compiled
1>AssemblyInfo.obj : /DEBUG:FASTLINK is not supported when managed code is present; restarting link with /DEBUG:FULL
1>AssemblyInfo.obj : MSIL module encountered; incremental linking is disabled for MSIL; performing full link
1>Obsidian.DSP.DirectShow.vcxproj -> S:\Obsidian.Topaz\x64\Debug\Obsidian.DSP.DirectShow.dll
1>ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor
1>Done building project "Obsidian.DSP.DirectShow.vcxproj".
========== Build: 1 succeeded, 0 failed, 16 up-to-date, 0 skipped ==========
That's it, no more information. Is it some kind of warning? Should I modify the code?
Here's an example of how one of these templates are defined (under a .cpp file)
template <class HostClock,class MasterClock>
void
CTClockSubordinate <HostClock, MasterClock>::OnMasterTime (
IN MasterClock MasterTime
)
{
...
}
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'
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
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