VS 2015 compiler error 'LCMapStringEx': identifier not found - visual-studio

My C++/MFC code compiles fine with VS 2013 but when I have compiled with VS 2015 I get this error:
C:\VS\VC\atlmfc\include\atlwinverapi.h(710):
error C3861: 'LCMapStringEx': identifier not found
I don't use LCMapString anywhere in my code, so I don't know where this come from?

I had the same problem. For me the cause was this: Part of the project had _WIN32_WINNT set in such a way that XP was supported, other files didn't have this define. So the MFC headers were included with different values for the supported platform leading to this strange error.

The definition is guarded for the minimum target windows version.
This guard uses one of your definitions or NTDDI_VERSION (which is created from the other definition within (sdkddkver.h).
Correcting the version details of _WIN32_WINNT, WINVER solved the issue.
Go to:
Properties->Configuration properties->C/C++->Preprocessor->Preprocessor
Definitions and check what macros are defined.
changing them to
NTDDI_VERSION= 0x06030000
WINVER=0x0A00
_WIN32_WINNT=0x0A00
solved my problem.
Here 0A00 is for windows10.Refer below link
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx

In StdAfx.h define the following macros:
//For Windows 10
NTDDI_VERSION 0x0A000000
#define WINVER 0x0A00
#define _WIN32_IE 0x0A00
Also refer below MSDN links for WINVER & NTDDI_VERSION according to your environment.
https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019
https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers

I Solved the problem. I had to manually delete all the obj files generated by the previous compiler, as the clean and rebuild option in VS 2015 seems that did not remove them correctly.

Correcting the version details of _WIN32_WINNT, _WIN32_WINNT solved the issue.
you can see the similar thread here.
Compile Errors upgrading ATL project from vs2010 to vs2013
(WINVER or _WIN32_WINNT)

I faced similar issue when I migrated project from Visual Studio 2005 to Visual Studio 2015.
Open the Vcxproj in notepad or any of your favorite editors and then search for <PreprocessorDefinitions> tag in my case I removed the WINVER=0x0501, when I removed it started working.

Related

__int64' followed by 'int64' is illegal

i have very old project who has been made in visual studio 2008 with windows xp 32 bit.
I am trying to run this project in windows 7 64 bit with visual studio 2017.
i dont know much details about the project.
i know that MFC MBCS pakage was use.
so now i am trying to compile it and got some compilation errors.
the main one is :
__int64' followed by 'int64' is illegal
in the stdint.h file.
the line that get the error is:
typedef long long int64_d
i check the project and there is no call or use of the stdint header.
i read that it can be because the code build with old version of c++ and now i try to compile with higher version then c++11.
any help will be very appraised.
Thank You!
Well i figure it out.
the problem was that i am using old libs and dlls(probably made by v100 toolset of VS 2010) ,
so i set the platform toolset to the same version of the visual studio that make those
libs and dlls - visual studio 2010 v100.
to do that go to :
right click on the project
properties
configuration properties
general
platform toolset
and set it to v100(or other version needed)
now it's work fine!

MFC does not support WINVER less than 0x0501

I have a C++ project that references many other projects/libraries. This is for an application that was created many years ago. About every once a year it is updated and a new version is done. I've used Visual Studio 6 to update and build new versions of this app for years now without any problems.
I am trying to switch to Visual Studio 10 (and now VS2013). Initially I ran into several warnings and errors which were due to compatibility issues between the VS versions. I was able to take care of most. However, I'm still somewhat confused by the following error:
error C1189: #error : MFC does not support WINVER less than 0x0501. Please change the definition of WINVER in your project properties or precompiled header. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\afxv_w32.h
The error occurs in a few of the referenced project libraries. I checked the project libraries in question and I cant find any reference to WINVER.
I have searched the internet for info on this and found some topics but nothing that is specific to my problem. Can someone shed some light as to what might be happening here?
Thanks in advance.
LA
All MFC apps define the WINVER macro value somewhere if you didn't define it yourself. I assume MS has removed the definition by default on its own header files and is now making mandatory that you explicitly define it.
So, to solve your problem, either put the #define in your 'preprocessor' compiler options, or at the top of your precompiled header (ie stdafx.h).
Note 0x501 is Windows XP support. 0x600 is Vista, 0x601 is Windows 7 — and how sad am I for remembering that!
I got the same error, on Windows 7 with Visual Studio 2013.
In my case my project had a source file with name stdafx.h, inside that file there was
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
I changed it to
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x601
#endif
and the error disappeared.
By default WINVER is defined as 0x0500 in preprocessor. To overcome from this error, remove defined win version "WINVER=0x0500" from
Configuration Properties => c/c++ => Preprocessor tab and rebuild.
Or you can provide higher WIN VERSION as #define _WIN32_WINNT 0x601 in your code wherever you getting error.

Migration from VS6 to VS10: 'AfxCrtErrorCheck' in atlmfc

I am trying to compile the code originally written in Visual studio 6 to VS 10.
I read in one of the MSDN article that 'atlmfc' has been removed from VS10. what is the alternative for atlmfc in VS10 ?
error is pointing to atlchecked.h file.
error C2664: 'AfxCrtErrorCheck' : cannot convert parameter 1 from 'char *' to 'errno_t'
1> There is no context in which this conversion is possible
.
.
program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2235): error C2065: 'cVal' : undeclared identifier
These errors are in all the header files like atlcomcli.h, oaidl.h.
part 1) I guess that whatever is included in #ifdef has not been recognized in VS10, I might need to give correct path or include relevant header file. Surprisingly no solution on the net so far. If I compare with other solution it doesnt seem to be a problem since path is correct. I am picking all the atlmfc files from visual studio 10 version.
part 2) as Scott said code change is required but here the problem it points to is
#ifdef _AFX
#define ATLMFC_CRT_ERRORCHECK(expr) AFX_CRT_ERRORCHECK(expr)
#else
#define ATLMFC_CRT_ERRORCHECK(expr) ATL_CRT_ERRORCHECK(expr)
#endif
One of the article on the net says - http://msdn.microsoft.com/en-us/library/bb531344.aspx
"#ifdefs in the MFC header files are removed." What does that mean ? if that is removed any alternative for that in Visual studio 10 ?
Also can i directly convert VS6 code to VS10 or should i convert it to VS8 first and then migrate it to VS10 ? Pls help.
'atlmfc' is a folder name in the VC directory. It has not been removed in the versions of VC that cost money but it is removed in the "express" version, which is free. You must have a paid-for version of VC to use the MFC and ATL libraries.
I think VS10 will open and convert your VS6 project, although the result will still require you to make code changes.
Well, direct conversion from visual studio 6 to VS10 is not possible. Why will microsoft allow that ? :)
we have to go through VS5 and then VS10.
also the conversion is gonna be extraordinarily difficult with lot of code changes.
http://www.devx.com/cplus/10MinuteSolution/28908

Compiling CUDA with Visual Studio 2010

I have used Visual Studio 2008 to compile and run CUDA applications before. I have switched to Visual Studio 2010 and Windows 7. I've been trying to get integration set up all morning, but haven't had complete success. I've downloaded the toolkit, installed Nsight, made sure the libraries/include/bin paths are set, checked the box to use a Build Customization of CUDA 3.2, and set the properties of the individual .cu file to be of type CUDA C/C++ instead of C/C++. I got an error about not supporting compiler v100, so I set the project platform to v90 and am downloading Visual Studio 2008 now. I was hoping that I wouldn't have to have two versions of visual studio installed, but oh well. Anyway, most of the syntax highlighting is enabled, some keywords like "int" is blue, comments are green, and strings are red. However, cuda-specific keywords like __ global__ aren't. Also, I've checked through the include directories and can't find cutil.h, so I'm wondering if there's anything else that wasn't included in the install of the 3.2 SDK (I have included cuda_runtime.h instead, but I don't know if this will solve my problems). Does anyone know how to fix this?
Edit: I have Visual Studio 2008 installed. When I try to compile, I get a giant list of errors, starting with 1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h(490): error : invalid redeclaration of type name "size_t", while most of the following errors have to deal with the size_t type. All of the errors are in included files, most of which I've never seen. Does anyone know what's going on? Or if there's a simple, step-by-step guide to getting VS2010 to use cuda?
Edit 2: Apparently I had one of the many current settings as 64-bit, and the others as 32-bit. Changing the active configuration, Cuda C/C++ Target Machine Platform, and Linker|Advanced Target Machine all to 32-bit or 64-bit allowed me to compile and run. I still don't have any idea how to fix the __ global__ and such syntax highlighting, but it's not that big of an issue.
You'll find a complete guide here:
How to Run CUDA In Visual Studio 2010
you can check if the source file that contains kernel is a CUDA/C file rather than a C/C++ file. (Solution Explorer -> File Properties)

Build the OpenCV 2.0 libraries from source using Visual Studio 2010 Beta and CMake

OpenCV 2.0a does not include pre-compiled OpenCV libraries for Visual Studio users. I am trying to build the libraries from source using Visual Studio 2010 Beta and CMake, but I am getting lot of errors.
I even tried generating the libs from dlls using dumpbin but the linker errors are still persisting. Please guide me to generate the static libs for VS2010.
If the build error you're seeing is related to:
'back_inserter': identifier not found
as is likely the case for the source files cvmodelest.cpp and cvhog.cpp, add the following include statement to each of those source files:
#include <iterator>
For more info about the 'back_inserter': identifier not found error, see this blog post.
It's kind of late, but I created a video tutorial for compiling and configuring OpenCV 2.1 with Visual Studio 2010.
Try this tutorial(dead) and this one out as well.
I tried this with VS 2010 and Windows 7.
See another StackOverflow thread. It's for VC++ 2008, but it may help.

Resources