Questions tagged [visual-c++]
Microsoft Visual C++ is a C, C++ and C++/CLI compiler for Windows. The most recent version of the compiler is Visual C++ 2022. The compiler supports the following languages: C (supports C90 and most of C99, C11, C17 parts of the ISO C++ standard as of Visual Studio 2022); C++ (support for most C++11, C++14, C++17, and C++20 features and few C++23 features as of Visual Studio 2022) C++/CLI (Provide interoperability with .NET languages like C#).
visual-c++
31,736
questions
0
votes
0
answers
22
views
Examining uninitialized heap memory, strange transition at size 1044472
In the following C++ program I am examining how many bytes are zeroed in the uninitialized heap memory.
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
static void CountZerosNonZeros(size_t ...
-2
votes
2
answers
88
views
"No operator '<<' matches these operands" error for JSON::Value, how to write it to cout? [duplicate]
My C++ program below is supposed to read a json file called english.json and display the "title" information.
#include <iostream>
#include <fstream>
#include <json/value.h>
...
5
votes
1
answer
88
views
Weird behaviour with 'if constexpr' and templates in MSVC
The code below behaves incorrectly.
When f<0> or f<5> is called, it prints as if k = true, but the if statement behaves as if k = false. When f<1> is called, it does the opposite.
...
0
votes
0
answers
50
views
C++: ODR and extern "C" on MSVC linker
I'm testing out how the Windows link.exe program reacts when presented with ODR violations. My intention is that the linker will fail when it notices that my program has two definitions of the same ...
0
votes
0
answers
13
views
How to make MSVC++ modules from NuGet available to import?
I want to publish my C++ modules to NuGet. However, tests have found that users are unable to import ixx modules in NuGet as they would with header files.
import ModuleFromNuGet; //Failed to build; ...
-3
votes
0
answers
52
views
how to solve include<iostream> problem on vs code? [duplicate]
i have tried a lot. still unable to solve the problem. dont even know why is it happening.
{
"configurations": [
{
"name": "Win32",
&...
0
votes
1
answer
22
views
Can anyone explain this error message ? C5275
I am facing a bad situation while trying to build an assembly DLL from C++ code, for .NET 7.0.
The compiler reports the messages below, even before it attempts to compile. (By the way, this should be ...
0
votes
1
answer
40
views
C++ lib build Windows VS2022: Build fails with platform toolset v143 - works with platform toolset v142
I am having the following issue with building a simple library (FLANN) from source on windows.
I get the code and use CMAKE to generate the VSSolution. Note
that I am disabling python, c and matlab ...
0
votes
0
answers
10
views
MSVC Linker: /NODEFAULTLIB and /DEFAULTLIB option
I noticed that the MSVC linker from Microsoft has among many other options these two options: /NODEFAULTLIB and /DEFAULTLIB.
The documentation says:
By default, /NODEFAULTLIB removes all default ...
0
votes
0
answers
25
views
Cmake Nested Projects Static Linking Problem with glew32s.lib and glfw3.lib [duplicate]
I am developing a library to easily create an OpenGL window context and display an image on it. I have two CMakeLists.txt files. The first one (top project) is for the .exe file, and the second one (...
1
vote
0
answers
92
views
Speed-up byte signature scanning in memory using SIMD
I'm searching for various byte patterns in big memory chunks using this code:
BOOLEAN Find(const unsigned char* data, SIZE_T data_size, const unsigned char* to_find, SIZE_T to_find_size, SIZE_T* index)...
0
votes
1
answer
14
views
Is there a way to "expand" an enum in C++ for "type-switching"?
For a project I need an observer class (owned by a Subject that then notifies all of its observers) that handles other behaviours.
These observers work by calling their onNotify( Event* ) method that ...
3
votes
0
answers
68
views
Is there a MSVC warning for using 0 instead of nullptr?
GCC and Clang have -Wzero-as-null-pointer-constant to flag the legacy use of 0 instead of nullptr. Does MSVC have a similar warning?
0
votes
0
answers
23
views
New to visual C++: Problem with saving a bmp from a frame after loading the bmp into it
So I've been using chatgpt to help (please don't start with the AI hate). But basically it can't find what is wrong.
Please bear in mind that this app is my first attempt at building anything with ...
0
votes
1
answer
56
views
Is there an MSVC equivalent to gcc's __attribute__(returns_nonnull))?
I learned about this little feature of GCC/Clang today:
Something * MyFunctionThatNeverReturnsNULL() __attribute__((returns_nonnull))
{
// code here that will never return a NULL value
static ...