31,788 questions
-3
votes
0
answers
58
views
Visual c++ - why printf acts strangely? [duplicate]
I am writing a console application with Visual C++ Studio Express Edition. I have several iterations which call a function which uses printf() function. It compiles successfully, but when I run the ...
0
votes
1
answer
107
views
Why do my property sheet outlook bar icons have a magenta tinge?
I am using MFC.
The property sheet is displaying the 32 x 32 images. And the dialogs static controls are showing the 64 by 64 versions.
The property sheet is of type CMFCPropertySheet
And the other ...
-1
votes
0
answers
114
views
evaluate arithmetics in C preprocessor to get numeric constant for MSVC __declspec(align(x))
The folowing code implements vector types based on aligned static arrays of arbitrary element type and count.
#define BITOP_RUP01__(x) ( (x) | ( (x) >> 1))
#define ...
10
votes
1
answer
435
views
MSVC don't consider conversion operator when initializing aggregate with parenthesis
I stumbled upon this code:
struct type1 { int a; };
struct type2 { int a; type1 agg; int b; };
struct deducer {
operator type1() {
return type1{};
}
};
auto main() -> int {
...
Advice
0
votes
0
replies
83
views
How do I display labels on multiple line cell elements simultaneously in VTK?
I'm new to VTK. I use the VC++ compiler and have always drawn objects using Windows GDI/GDI+ and OpenGL. I'm currently switching to VTK for practical reasons, and I'm very happy with it because it ...
4
votes
2
answers
153
views
Cannot specify `__forceinline` for an implementation of a member function in a separate translation unit
Consider the following three files "main.cpp"
#include ".hpp"
__declspec(noinline)
int main(int, char**)
{
x().DoFoo();
x::dobar();
::dobaz();
return 0;
}
"....
0
votes
0
answers
79
views
Is there a way to include debug information into PDB-file selectively?
I build my C++ program in Visual Studio 2022 (cmake-project) using a large static-built library (QT).
The library was built in Debugx64 mode. I want to build program including debug information for it,...
Advice
1
vote
6
replies
182
views
Ai Neural Network | C++ | Project Guidance --- Matrix Part
I’m an undergraduate CS student working on a final project due in about a month, and I’m trying to design and implement a C++-based AI Neural Network Simulator integrated into a small game environment....
6
votes
0
answers
232
views
Why is module std available even though it isn't re-exported?
Consider this simple code with two files:
module.ixx
export module m;
import std;
export namespace m {
struct Object {
std::string_view data() {
return "DATA";
}
};
}
...
1
vote
1
answer
176
views
Why does this valid C++20 code compile on Clang but fail on MSVC with a template deduction error? [closed]
I’m experimenting with C++20 concepts and encountered a compiler discrepancy.
This code compiles on Clang 17 and GCC 13, but MSVC (VS2022) rejects it:
template <typename T>
concept HasFoo = ...
6
votes
0
answers
186
views
Type aliases for functions with auto deduced return type in Visual C++
I found accidently that MSVC compiler from Visual Studio allows one to declare an alias for a function type with auto deduced return type, see T in the example program as follows:
auto l = +[]{ return ...
Best practices
1
vote
2
replies
85
views
Providing stubs to a static library
Environment:
Windows, Visual Studio, low level.
A bit of context:
One of my project is a static library with C functions that export functionalities. Some of those C functions make use of C functions ...
1
vote
1
answer
145
views
Why does initializing std::atomic_flag with false work on GCC and Clang but not Visual Studio?
Here is the code:
#include <atomic>
std::atomic_flag bShouldStop = false;
int main() {
}
Compiles on GCC and Clang but not on Visual Studio, gives errors:
<source>(6): error C2440: '...
0
votes
0
answers
173
views
OpenCppCoverage not reporting untouched files
I have a Visual Studio solution with this architecture:
core.lib
api.dll (imports core.lib, no actual code)
tests.exe (imports core.lib)
I'm running OpenCppCoverage from the root of the solution ...
0
votes
1
answer
214
views
How to compile a 32-bit executable via cl.exe with VS Code?
In the 64-bit Windows 10 OS, I want to compile a 32-bit Windows executable via cl.exe with Visual Studio Code. I have installed C/C++, CMAKE and C/C++ DevTools extensions and installed Visuall C++ ...
