814,875 questions
6
votes
1
answer
67
views
Why is the module name a part of a mangled name for functions exported from C++20 modules?
Any function declared in a C++20 module seems to get mangled in a way that includes the module name. For example:
export module A;
export void a(int);
int main()
{
a(42);
}
This a gets mangled ...
0
votes
1
answer
67
views
error: ‘format’ attribute argument 3 value ‘7’ does not refer to a variable argument list
There is a similar post but it doesn't help. The solution in that post is that it was a gcc bug which was fixed. Does gcc 15.2 has the bug again?
I receive for the below code snapshot these error ...
1
vote
0
answers
32
views
Cmake::find_package not including package header files directory
I have a shared library project libproj which needs to be added as a dependency to a binary project binproj, where it needs to include the library header files, for this I'm using cmake find_package ...
1
vote
1
answer
44
views
Implementation attempt of MPSC queue using atomics
Coming here from codereview.
I was trying to implement a multiple producer single consumer (MPSC) queue using atomics.
Currently, I am facing some race condition that I am having difficulty solving.
==...
0
votes
0
answers
29
views
Canon EDSDK decoding Evf Memory Stream data
I actually have what I want working in Python with PySide and edsdk-python, however I am trying to get this working in C++ and stumbling on the decoding of the memory stream data.
Here is the relevant ...
1
vote
1
answer
105
views
Usage of non-initialized class field 'myMap' when called from function 'main'
MRE:
#include <unordered_map>
#include <string>
class MyClass {
private:
std::unordered_map<std::string, int> myMap;
public:
MyClass()
: myMap() {}
};
int main()
{
...
0
votes
2
answers
149
views
Why am I getting conflicting error messages relating to my strings?
I'm working on a C++ program for a college project, and I have the following code written down:
const wchar_t g_szClassName[] = L"myWindowClass";
// Step 4: the Window Procedure
LRESULT ...
0
votes
0
answers
48
views
cmake rust crate doesn't install header files and libraries to /usr/local/{include, lib} paths
In my project, the Rust binary rust-bin needs to link to a C++ shared library sub-project cpp-lib, for which I'm using cmake rust crate as a build dependency. The entire project builds fine, but the C+...
Best practices
0
votes
5
replies
93
views
Connection with OPC Server in C++
I am a newbie and I want to connect with my OPC server by means of c++.
Please write me a code and talk my which library is good.
I use a .NET framework too.
Write to me a easy launguage, because I am ...
0
votes
1
answer
102
views
VSCode C/C++ extension not recognizing C++26 features
I use GCC15. I want to use the C++26 feature std::views::concat. Now I'm using VSCode and the extensions "C/C++" and "CMake".
This is my code main.cpp:
#include <ranges>
#...
Best practices
1
vote
6
replies
103
views
How reliably and safely detect hardware timer overflow causing logic error
I'm trying to find a best-practice method to handle an edge case when a hardware clock timer wraps around and the overflown value generates a false positive logic match.
For example, on a 16 MHz chip, ...
1
vote
1
answer
162
views
How can one initialise a std::unordered_map with a given starting size (less than the default)? [closed]
I've checked the std::unordered_map documentation, and it still doesn't give me an answer on how to change the starting size of an unordered_map. I may or may not use an allocator, but I'm not sure ...
Advice
0
votes
11
replies
159
views
How to use default arguments with std::function?
I wrote the below test code. As can be seen, I can use default arguments for a traditional function call, but not for invoking a std::function object (if I were to uncomment the commented out ...
0
votes
0
answers
93
views
Create assignment operator in templated base class [duplicate]
I have a templated base class which looks like this:
enum class PushConstantType { vec1, vec2, vec4 };
template<typename T, PushConstantType P>
struct PushConstant
{
PushConstant<T, P>...
-2
votes
0
answers
81
views
c++ constexpr string length too long? [duplicate]
I am trying to append to a string in a constexpr function, it seems to fail once the string grows to 16 characters and it does this consistently under MSVC, GCC and Clang. Reserve doesn't help.
#...