Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [c++]

C++ is a general-purpose programming language. Use this tag for questions about/utilizing C++. Do not also tag questions with [c] unless you have a good reason. C and C++ are different languages. Use a versioned tag such as [c++11], [c++20] etc. for questions specific to a standard revision.

c++
1 vote
1 answer
32 views

explicit deleted constructors - does this matter?

When marking a constructor as deleted, i.e. class MyClass { // ... MyClass(int x) = delete; // ... }; is there any effect to marking the deleted constructor as explicit? i.e. ...
2 votes
1 answer
1k views

Can't find c++ header files and MacOSX12.1.SDK through CMake in Clion macOS. But Xcode is working

I'm in macOS Monterey 12.3. When I try to load my CMAKE file on CLion. I got this error, it says that it can not find the MacOSX12.1.SDK. But my current version is in 12.3. I'm not sure why it goes to ...
0 votes
1 answer
51 views

ambiguous partial specializations

I have a big 3rd party library that I am trying to compile with latest clang (version 19) and I keep running into ambiguous partial specializations error. A minimal sample to reproduce the issue looks ...
-1 votes
0 answers
21 views

What does "+ +" (with space between + operators) do in C++? [duplicate]

The following code: float a = 1.5; float b = a + + 1.2; compiles and actually returns 2.7 for b. Why does it compile, shouldn't the extraneous + be flagged as a syntax error? It compiles on several ...
40 votes
5 answers
25k views

C++ equivalent of Rust's Result<T, E> type?

I like using std::experimental::optional in my C++ code, but the problem is value_or requires the default value to be of the same type as the optional's value. This doesn't work very well when I want ...
0 votes
0 answers
12 views

How do I create CRUD in C++ and connect it to a database. A sample code or link to specific Youtube tutorial will be helpful. Thank you [closed]

I do not how to Create, Read, Update, and Delete database in C++ I tried to install mysql on my computer and I cannot connect it. My laptop's operating system is windows. I am finding it difficult to ...
-1 votes
1 answer
26 views

getting "expression list treated as compound expression in functional cast" CE, but everything looks just fine

I tried building this: whole code (unordered_map.h): https://pastebin.com/u9aMaqRp test: https://pastebin.com/KqrKwNt0 and got a CE out of nowhere...? getting a strange compilation error while ...
0 votes
1 answer
61 views

How to build recursion to calculate intermediate points if the distribution law is known

Interstage temperatures There is a problem: calculate interstage temperatures of the thermoelectric module. Each interstage temperature could be defined by neighboring temperatures as Ti=pow(Ti+1 * ...
39 votes
7 answers
80k views

How to use SDL2 and SDL_image with cmake

I'm looking for the simplest way to compile a c++ program using SDL2 and SDL_image with cmake. Here is my best attempt, after hours of searching: CMakeLists.txt project(shooter-cmake2) ...
57 votes
20 answers
118k views

VS Code will not build c++ program with multiple .cpp source files

I'm trying to build a simple program that has multiple .cpp files. I'm using VS Code on Ubuntu 17.10 and using the GCC Compiler. Here's an example of what I've got (all the files are in the same ...
6 votes
4 answers
5k views

Which is more efficient for sines and cosines? Sin and Cos or Sin and Sqrt?

Unfortunately, the standard C++ library doesn't have a single call for sincos, which gives a place for this question. First question: If I want to calculate a sin and a cos, is it cheaper to ...
-11 votes
0 answers
51 views

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8ed191184, pid=51412, tid=0x0000000000009a34 [closed]

I am writing protection for the maincraft cheat in the form of a native and when I added lazy importer I started having such errors # A fatal error has been detected by the Java Runtime Environment: # ...
0 votes
0 answers
10 views

Using GDALWarp to combine and crop HGT files

I'm trying to take a bounding box, and crop only that section from whatever source amount of HGT files are needed. I see it should be possible from this. Using GDALWarp with the following results in ...
0 votes
0 answers
68 views

How to determine the actual (not theoretical) maximal size of vector in C++ [duplicate]

Is there a way to determine the actual maximal vector size possible at run time (in C++), other than trying vec.resize(size) for different sizes by trail and error? (vec.max_size() provides only the ...
0 votes
2 answers
72 views

Templated constructor of abstract class without parameter type deduction in C++

I want my abstract base class to have a templated constructor, but can't get it to work without an extra parameter to deduct the type from. I want to do something like this: class Base { public: ...

15 30 50 per page
1
2 3 4 5
53996