c++ - Error compiling Anax with Visual Studio 2013 - c++

I recently motivate myself to code ECS way. So i download anax and tryed to compile it. Here is the problem, i only tryed and didn't achieved it. I generated the file for Visual Studio and upgraded msvc12 to latest version. But now i get this error and I have no idea how to fix it :
error C2664: 'void std::vector>::emplace_back(anax::Entity::Id::int_type &,unsigned __int64 &)' : cannot convert argument 1 from 'anax::Entity::Id::int_type' to 'anax::Entity::Id::int_type &'
And here is the code line which throws the error :
m_freeList.emplace_back(static_cast<Entity::Id::int_type>(id.index), counter);
Does someone has an idea how to fix this ?

Related

MSVC Visual studio, error C2440: 'initializing': cannot convert from 'initializer list' to 'dx::RootBindings<1>'

I am following a DirectX 12 tutorial series on YouTube. I tried to build the project using Visual Studio 2022 but I am getting the error C2440: 'initializing': cannot convert from 'initializer list' to 'dx::RootBindings<1>'.
There are multiple instances where following kind of initialization is giving the same error.
static dx::RootBindings<1> rootBindings = {
dx::ROOT_ELEMENT<DX_ROOT_TYPE_TABLE>(m_descHeapSrvCbv.get(0).gpuHandle),
};
I think GCC will be able to compile above code, but since I am building DirectX 12 project so I have to use Microsoft MSVC compiler. Maybe some settings in the Visual Studio can resolve the error.
I am attaching the link to the GitHub repo and the code snippet for reference.
GitHub Repo: Drawing a Triangle.
Code Snippet

errors C2784, C2672 and C2664 in Visual studio 2015

I have following lines in visual studio 2015. It used to be compiled without error in visual studio 2013.
const std::basic_regex<wchar_t> e(_T("([eE][-+])(0)(\\d{2})"));
io_string = std::regex_replace(io_string, e, _T("$1$3"));
the error is:
error C2664: 'std::basic_regex>::basic_regex(std::basic_regex> &&) noexcept': cannot convert argument 1 from 'const char [21]' to 'const wchar_t *'
error C2672: 'std::regex_replace': no matching overloaded function found
4>
error C2784: 'std::basic_string<_Elem,std::char_traits<_Elem>,std::allocator<_Other>> std::regex_replace(const _Elem *,const std::basic_regex<_Elem,_RxTraits> &,const _Elem *,std::regex_constants::match_flag_type)': could not deduce template argument for 'const _Elem *' from 'std::string_t'
I know this issue is coming from change tchar.h. Any suggestion for resolving them. I also use CMake for project configuration and the project is running on windows 10.
Assuming you don't want to change your code, you need to ensure that your code is building for Unicode, so pass -D_UNICODE to the compiler. This post suggests:
ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-D_UNICODE)
And this one illustrates how to enable Unicode through the GUI.

Asio Compiler errors (Win7 64 Bit + VC11)

a few days ago I upgraded from Win7 32Bit + Visual Studio 2008 to Win7 64Bit + Visual Studio 2012 (VC11). Now I have problems with compiling my application. I get the following errors:
1>...\asio-1.5.3\include\asio/detail/impl/win_thread.ipp(51): error C2664: 'QueueUserAPC': cannot convert parameter 1 from 'void (__cdecl *)(ULONG)' to 'PAPCFUNC'
1>...\asio-1.5.3\include\asio/detail/impl/win_iocp_io_service.ipp(119): error C2664: 'GetQueuedCompletionStatus': cannot convert parameter 3 from 'DWORD *' to 'PULONG_PTR'
1>...\asio-1.5.3\include\asio/detail/impl/win_iocp_io_service.ipp(349): error C2664: 'GetQueuedCompletionStatus': cannot convert parameter 3 from 'DWORD *' to 'PULONG_PTR'
And I get the same errors with the latest version of boost::asio (Boost 1.52)
What’s wrong here?
with WINVER set to 0x0501 it's working - Many Thanks to Hans Passant for his hint!

Newbie chrome-plugin developer needs help getting started with NPAPI

Although only having done a very little in C++ before I'm trying to compile the following chrome plugin so that I can see how it works and use that as a starting point to develop something similar: http://code.google.com/p/minimizetotray/source/browse/trunk/?r=17#trunk%2FDLL
So far I have taken the following steps: downloaded the source, opened it in MS Visual Studio Pro 2008, and obtained a few of SDKs and headerfiles it was asking for including the latest version of the NPAPI headers: http://npapi-sdk.googlecode.com/svn/trunk/headers/
Now I get the following errors when I try to compile and have no idea how to sort this.
Compiling...
JSMethods.cpp
c:\documents and settings\dell customer\desktop\dll\jsmethods.cpp(92) : error C2039: 'UTF8length' : is not a member of '_NPString'
c:\program files\microsoft visual studio 9.0\vc\include\plugin\npruntime.h(85) : see declaration of '_NPString'
c:\documents and settings\dell customer\desktop\dll\jsmethods.cpp(101) : error C2039: 'UTF8characters' : is not a member of '_NPString'
c:\program files\microsoft visual studio 9.0\vc\include\plugin\npruntime.h(85) : see declaration of '_NPString'
Etc...
Apart from those two errors it all seems dandy, its not asking for missing includes or anything. Any help appreciated!
Unless I'm mistaken on the latest SDK the _NPString struct is defined as...
typedef char NPUTF8;
typedef struct _NPString {
const NPUTF8 *UTF8Characters;
uint32_t UTF8Length;
} NPString;
And in your code you are calling UTF8length instead of UTF8Length (uppercase L).

Trying to compile Tessnet2 (Visual Studio 2008 C++) project in Visual Studio 2010

I downloaded the Tessnet2 project from http://www.pixel-technology.com/freeware/tessnet2/ and I am able to build it fine in Visual Studio 2008. However, I need to recompile it for .NET 4. I know very little about C++, but the errors I am getting when i try to compile with VS 2010 are:
Error 4 error C2439: 'std::_Pair_base<_Ty1,_Ty2>::first' : member could not be initialized C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility 163 1 tessnet2
Error 6 error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be initialized C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility 163 1 tessnet2
Error 3 error C2440: 'initializing' : cannot convert from 'int' to 'ScrollView *' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility 163 1 tessnet2
Error 5 error C2440: 'initializing' : cannot convert from 'int' to 'SVEvent *' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility 163 1 tessnet2
I'm assuming you can't just open a 2008 C++ project in 2010 and do a simple convert like most actual .NET projects. But, if anyone can give me some insight on this I appreciate it.
I had the same problem.
It seems that the VS2010 compiler is stricter about NULL being defined as a the literal 0 than the VS2008 one was. Therefore you must explicitly cast the NULL references in this project to their corresponding class types.
Specifically, you must make the following four changes to the scrollview.cpp file to get the project to compile:
-- Change line 137
std::pair<ScrollView*, SVEventType> awaiting_list_any_window(NULL,
SVET_ANY);
to
std::pair<ScrollView*, SVEventType> awaiting_list_any_window((ScrollView*)NULL,
SVET_ANY);
-- Change line 409
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, NULL);
to
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*) NULL);
-- Change line 427
std::pair<ScrollView*, SVEventType> ea(NULL, SVET_ANY);
to
std::pair<ScrollView*, SVEventType> ea((ScrollView*)NULL, SVET_ANY);
-- Change line 429
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, NULL);
to
waiting_for_events[ea] = std::pair<SVSemaphore*, SVEvent*> (sem, (SVEvent*) NULL);