LegacyAddin works no more in NATVIS Visual Studio 2022 - debugging

LegacyAddin worked fine until VisualStudio 2019. But the 'natvis' code below stopped to work since Visual Studio 2022:
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="ATL::COleDateTime">
<DisplayString LegacyAddin="ClassLibrary1.dll" Export='Class1'></DisplayString>
</Type>
</AutoVisualizer>
When I compile ClassLibrary1.dll in C++ (as used to be) it not even loads. When I compile it using C#, it loads but I get the following message:
Natvis: C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Packages\Debugger\Visualizers\CardiosAddin.natvis(4,3): Error: Failed to load addin from C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Packages\Debugger\Visualizers\ClassLibrary1.dll for type ATL::COleDateTime: Addin dll missing export 汃獡ㅳ.
Note: the japanese characters seems to be the Export string interpreted as unicode...

Solved! Just compile the dll (ATL C++ is OK; C# not tested) in 64 bits (x64 Platform) and export the dll functions using extern "C".

Related

Clang C2 on Visual studio 15.5 bool_constant<__is_trivially_destructible(_Ty)> error : '_Ty' does not refer to a value

I am trying to re-compile a hello world using Clang_C2 compiler on Visual studio 15.5 (latest).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\type_traits(899,2): error : expected class name
1> { // determine whether _Ty has a trivial destructor
In file included from ..\hello_boost_exception\hello_boost_exception.cpp:11:
1>In file included from I:\modular-boost\boost/config.hpp:48:
1>In file included from I:\modular-boost\boost/config/stdlib/dinkumware.hpp:98:
1>In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\typeinfo:22:
1>In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\exception:7:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\type_traits(898,47):
This looks as though I have some missing or incorrect library but I can't see what.
I have try various compiler versions C++14 (-std=c++1y) and library -stdlib=libc++ (should it use dinkumware version of type_traits?) but the error persists.
Suggestions most welcome.
Paul

VS 2010 and CMake: 'rc' is not recognized as an internal or external command

I'm trying to build a project on Windows 10 - Home using VS 2010 and CMake.
I'm getting the following errors:
zutil.c
lib -nologo -out:zlib.lib adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
rc /dWIN32 /r /fozlib1.res ./win32/zlib1.rc
'rc' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.
*.dll
The system cannot find the file specified.
0 file(s) copied.
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
The system cannot find the file specified.
-- The C compiler identification is MSVC 16.0.40219.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake3.6/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Project/build/libpng-1.6.7-build/CMakeFiles/CMakeTmp
Does anyone know what the cause of:
'rc' is not recognized as an internal or external command,
operable program or batch file."
would be?
I'm assuming that's also causing the cl.exe is broken error?
The last time I had this problem was when my Visual Studio 2012 Professional standard installation did not install any Windows SDK (the error log was showing an missing SDK header).
To verify your SDK installation e.g. check that you have any Resource Compiler installed. It should be in a path similar to:
C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe
Since I was missing this - or more accurate any SDK - I installed Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs. I think for Visual Studio 2010 the default would be the Windows 7.0a SDK and for Visual Studio 2015 it would be Windows 10 SDK with Universal C Runtime.
Reference
The CXX compiler identification is unknown
Visual Studio 2010 Express, Windows SDK 7.1, CMake and 64 bit

Set up x64 in Visual C++ 2010

I am trying to learn x64 assembly using Visual Studion 2010.
I was following this video tutorial : x64 Assembly and C++ Tutorial 1: Getting into x64 ASM from C++
As it says, I installed Visual Studio 2010, windows 7 SDK 3.5 (ISO install) and edited the configuration.
But when I compile the code, I get following error :
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml64.exe /c /nologo /Zi /Fo"x64\Debug\asm.obj" /W3 /errorReport:prompt /Taasm.asm" exited with code 1.
What is this problem, and how can I solve it?
Look at the assembler output above that line, or build the .asm file by itself.
You should see warnings generated by the assembler
eg. "somefile.asm(564): warning A6004: procedure argument or local not referenced :"
Deal with those warnings. The "exited with code 1" is not very explanatory.

Qt 4.8.3 Windows 7 Compile Using Visual Studio Express 2012

I'm still new to Qt. In the past I used to download Qt on a computer and install it without any problems and I get immediate access to all Qt SDK resources including QtCreator.
Now, I downloaded Qt SDK 4.8.3 and after some reading I ended up installing Windows SDK 7. Then I extracted Qt files to C:\Qt. I also added C:\Qt\4.8.3\ to the system path. Then I ran configure which is concluded with no errors. Then I attempted to run nmake which failed with the following error:
Generating Code...
link /LIBPATH:"c:\Qt\4.8.3\lib" /LIBPATH:"c:\Qt\4.8.3\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /BASE:0x67000000 /DEBUG /DLL /MANIFEST /MANIFESTFILE:"tmp\obj\debug_shared\QtCored.intermediate.manifest" /VERSION:4.83 /OUT:....\lib\QtCored4.dll #C:\Users\MELKAM~1\AppData\Local\Temp\nm5A03.tmp
Creating library ....\lib\QtCored4.lib and object ....\lib\QtCored4.exp
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\link.EXE"' : return code '0x463'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
Now I have tried the above twice with no luck. Any pointer where should I look? any suggestions are appreciated.
Thanks.
What are you compiling with? MSVC or mingw? If the former, I have found this link incredibly helpful...
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/
I have followed his instructions for 64bit and 32bit builds many times.
Edit: You have your qt build configured for a MSVC2010 (1600) build, so it's looking in the "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" directory, which doesn't exist if you only have MSVC2012 (which is version 11.0).
Qt 4.8 doesn't officially support MSVC2012 (yet?), but if you really want to use 2012 then you can try the suggestions at this link. It's complicated, especially if this is your first source build, but seems do-able if you're willing to tinker with the Qt source code.
I had the same issue. the problem was installing visual studio 2012 on a machine with visual studio 2010.
May be this can help https://stackoverflow.com/a/15132209/1933829
Did you run configure from the 64bit tools command tool in vs?
Did you add -platform win32-msvc2010 to the configure commandline (yes even for 64bit builds you need -win32- )

Visual Studio 2010 includes MFC even though empty console application is specified (C++)

I've spent most of my day trying to figure out why this error is occurring but it continues to mystify me.
I created a console application in Visual C++ and specified it to be empty. After putting all of my source in the virtual folder and compiling it an error occurred:
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
Strange error indeed, because I never included any MFC files. So I remedied the situation by specifying "/MT" in the code generation settings.
This worked well...until I decided to include "Windows.h", which spawned this error:
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxv_w32.h(16): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxv_w32.h(16): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include windows.h
I've tried everything I could think of, including recreating the project with and without precompiled headers, a Win32 app rather than console, and a WxWidget app. All of these apps seemingly try to include MFC even though I never specified. Can anyone shed some light on this problem? Thank you!
Find out what's including the MFC headers - the /showIncludes option may help with that.
Which in the IDE project property page is under:
C/C++ | Advanced | Show Includes
Once you know who is including them you can make a decision on how to address the problem - you might simply be able to remove an errant #include, but it might require jettisoning a library you're using that's dependent on MFC.
Make sure 'USE of MFC' is in 'Use MFC in a Shared DLL' setting. That fixed it for me.
If MFC is required, set the following values ( Debug/Win32 ):
Configuration Properties > General :
Use of MFC : Use MFC in a Shared DLL
Configuration Properties > C/C++ > Code Generation :
Runtime Library : /MDd
If MFC is not required, and only standard window libraries are required, keep the setting as below.
Configuration Properties > General :
Use of MFC : Use Standard Windows Libraries
Configuration Properties > C/C++ > Code Generation :
Runtime Library : /MTd

Resources