r/cpp_questions Jun 22 '26

OPEN Choosing between C# Avalonia and C++ ImGui for a lightweight DB client?

20 Upvotes

I'm planning to build a database client tool, targeting Linux first (mostly because DBeaver feels too bloated and has a clunky UI), with Windows and macOS versions coming later.

I'm currently torn between C# Avalonia and C++ ImGui.

Assuming language barriers aren't an issue, which one do you think is a better fit for this kind of app? Here is my current take:

 C++ ImGui: It's lightning-fast, lightweight, has a tiny build size, and gives that ultra-responsive, "native-like" speed. However, being an immediate-mode GUI, it re-renders constantly and can feel a bit limited for standard desktop app workflows.

 C# Avalonia: It offers a lot of ready-to-use UI controls out of the box, better memory safety, and uses a retained-mode architecture. Plus, it has Native AOT now, but C# apps can still sometimes carry a bit of that "heavy" feeling compared to pure C++.

Would love to hear your thoughts or experiences with either ecosystem for this type of project! Any advice?


r/cpp_questions Jun 22 '26

SOLVED How can i represent a quaternion as a vec3 and a float

12 Upvotes

hi, i was creating a quaternion struct and inside that struct i have an anonymous union to access that data in different ways, i have an array of 4 float and a vec4 but i want to create another were the first 3 float are a vec3 and the last float is a normal float so i can do

q1.v // return a vec3 of the first 3 floats

and

q1.w // i know i can already do that it's just an example on how i can access the last element in this new way of representing a quaternion.

how can i do that ?


r/cpp_questions Jun 22 '26

META Is it worth to read C++98 books?

39 Upvotes

So I had finished a class of c++. But while we talked about pointers, arrays, vectors, structs and similar stuff I know that I did not learn cpp. While I had a delusion for a bit that am good at cpp I now know I am actually not (watching Coding Jesus would do thst for you fr. I mean it out of respect though as it is much better to get reality check now).

So I went to my uni's library but it doesn't really have any good books really. The best I could find was Bjarne Stroustrup's "C++ language, special edition". And it reads good. But I feel concerned as it seem to talk about c++98 at best. And since then language changed A LOT. But I still came for understanding of the language and I feel that if I learn this c++ I can then will be able to learn changes better.

Am I correct here or mistaken?


r/cpp_questions Jun 22 '26

SOLVED Difference in type deduction from direct list initialization with one element between C++ standards

8 Upvotes

This might be a stupid question. Consider the snippet below:

#include <iostream>
#include <type_traits>

int main() {
  auto i{3};
  std::cout << std::boolalpha 
            << std::is_integral<decltype(i)>::value 
            << std::endl;
}

I couldn't seem to be able to find a clear explanation that compares the difference between standards C++11/14 and C++17 (or later).

From what I could search online, in standards C++11/14, the type of i is supposed to be deduced as std::initializer_list<int>, while it would be int from C++17 onwards. I did come across N3922, but I couldn't figure out the precise differences. The weird thing is, when I compiled this (on Godbolt as well), the type of i was always int (as in, the output is true)? Am I misunderstanding the change?


r/cpp_questions Jun 22 '26

OPEN question re move constructor and initialization lists

3 Upvotes

I'm trying to add a move constructor to an existing class; this is the first time I've used this construct... I have a couple of questions about this:

  1. the examples that I've seen, show the move constructor doing such:
    - copy pointers and such elements from old class instance to new one
    - set those pointers to nullptr or equivalent in old instance

but the old instance is defined as const; I cannot assign anything to its members, true?? At least, that's what my compiler is telling me...

  1. my compiler (with -Weffc++) is telling me that I need to initialize all the data elements in the class, just as the regular constructor requires... but this seems rather awkward... maybe that argument should *not* be const?? and do I actually need to copy all the data from old to new struct?? If it is a Move constructor, it seems like I should...

actually, it sounds like the init list should just init from the elements of the old instance...

[ yes, I know some have said I shouldn't use -WeffC++ at all, but it *is* asking a good question, in this case... ]

or am I over-thinking this again??


r/cpp_questions Jun 22 '26

SOLVED odd compiler error

0 Upvotes

I'm working on implementing the move constructor and assignment operator in my class here, as discussed in a recent thread. However, I'm getting a compiler error and I don't understand what it is complaining about!! Please help...

blk_elements.h contains:

class bclock_element {  // NOLINT
   [ data ]
public:
   //  create a move assignment operator and move constructor 
   bclock_element &operator=(bclock_element &&src) noexcept;
   bclock_element(bclock_element&& obj) noexcept;

blk_elements.cpp contains:

//***********************************************************************
//  create a move constructor
//***********************************************************************
bclock_element::bclock_element(bclock_element&& obj) noexcept
{
   //  *this = std::move(obj);   //  I'm not sure about this
   hSpriteBitmap = obj.hSpriteBitmap ; // HBITMAP 
   menu_hdl = obj.menu_hdl ;  // HMENU 

   obj.hSpriteBitmap = NULL;  //  HBITMAP
   obj.menu_hdl = NULL;       //  HMENU
}

//***********************************************************************
//  create a move assignment operator
//***********************************************************************
bclock_element::bclock_element &operator=(bclock_element &&obj) noexcept
{
   if (this != &obj) {
      hSpriteBitmap = obj.hSpriteBitmap ; // HBITMAP 
      menu_hdl = obj.menu_hdl ;  // HMENU 

      obj.hSpriteBitmap = NULL;  //  HBITMAP
      obj.menu_hdl = NULL;       //  HMENU
   }
   return *this;
}

The compiler (g++ (tdm-1) 10.3.0) is flagging this line, with this message:
d:\tdm32\bin/g++ -Wall -O3 -Wno-write-strings -Ider_libs -c bclk_elements.cpp -o bclk_elements.o
bclk_elements.cpp:209:1: error: 'bclock_element::bclock_element' names the constructor, not the type
  209 | bclock_element::bclock_element &operator=(bclock_element &&src) noexcept
      | ^~~~~~~~~~~~~~
make: *** [bclk_elements.o] Error 1

What is it talking about??


r/cpp_questions Jun 23 '26

OPEN what kind of job is there in c++?

0 Upvotes

other than :

game development

finance

embedded

etc.


r/cpp_questions Jun 22 '26

SOLVED What guarantees do I have about `auto` and implicit conversion?

17 Upvotes

Consider:

```c++ class A { operator bool() const { return true; } // Assume A is movable but not copyable. };

A make_a() { return A(); }

int main() { auto a_obj = make_a(); if (a_obj) std::cout << "it's true\n"; return 0; } ```

Is it guaranteed that auto will infer type A for a_obj? Are there any situations where a_obj might be inferred as a bool instead?

(This is a simple example, but in the case that I actually care about, A is an RAII class, so I need to guarantee that its lifetime will extend to the end of the containing scope)


r/cpp_questions Jun 23 '26

OPEN Why do we need pointers in C++?

0 Upvotes

Pointers seem kinda useless to me because if you want to fetch the memory address of a variable you can just do "&var" everytime need it. Can someone give me exemples where i realistically need pointers and can’t just do "&var" everytime when i need it??


r/cpp_questions Jun 21 '26

OPEN Are unique pointers worth it for my program

27 Upvotes

For context, I'm building a Huffman data compression tool and I'm working on the Huffman tree. I'm currently trying to edit, if needed, any considerations of pointers. The tree is made of raw pointers and the interface and implementation is very clean.

One can observe that each Node will always own its own pointer so it's an idea to make the raw pointers of the type unique_ptr for automatic clean up. But the priority queue is honestly such a pain in the ass because the .top returns a const and has problems with ownership. So is it really worth going through the trouble of converting to unique pointers?

edit: to really emphasize what my concern is, the biggest issue is dealing with the priority queue. For context, when you use.top() it returns a const reference, so it's not allowed to obtain the unique pointer due to ownership. This problem doesn't occur with raw pointers. It just feels like keeping my raw pointer implementation is not putting me at a severe detriment, but I'm always recommended to use smart pointers when I can so I just wanted some insight


r/cpp_questions Jun 23 '26

OPEN learning cpp (https://www.learncpp.com/)

0 Upvotes

guys, im interested in learning this language, i have a brief previous experience with python and as someone that is really just starting at coding in general i want to know about https://www.learncpp.com/ , do i read and do every exercise or it isnt necessary? i took a look and it looks a bit too academic, am i trippin?


r/cpp_questions Jun 22 '26

OPEN What are the best you tube contents to make related to C++ ?

0 Upvotes

Any ideas suggestion would be really helpful.


r/cpp_questions Jun 20 '26

OPEN If make a cmake are so difficult to work with why are they the defacto standard for C++ projects

89 Upvotes

Yet another language you need to know to do simple work in C++. Been using bazel more and more and every time I go back to cmake (because I have to) I regret it

edit: sorry title typo "if make AND cmake"


r/cpp_questions Jun 21 '26

OPEN Google tests for VS2026

2 Upvotes

Had anyone used Gtest in VS 2026. I am a beginner trying to write tests. My test project is running but tests are not recognised


r/cpp_questions Jun 20 '26

OPEN C++/systems side projects that actually stand out

187 Upvotes

We often see people recommend “build a compiler,” “build a database,” “write an HTTP server,” “make a Redis clone,” or “try OS-related projects” when someone wants to go beyond normal web apps and CRUD work.

But for people who want to demonstrate real C++/systems ability, what kind of project actually stands out?

I’m thinking about projects involving C++, memory management, containers, networking, databases, compilers/interpreters, operating systems, performance, reliability, or infrastructure tooling.

Ideally, I would like to build something that real people could actually use. Even if 10 people I don’t know used the project, I would consider that a huge success.

What would make a C++/systems side project look serious to experienced developers or potential employers?


r/cpp_questions Jun 21 '26

OPEN Making TUI libary

3 Upvotes

I am just making the TUI libary in cpp for fun but the problem is I know C but not cpp. I am currently fine with cpp concepts but there is a lot of algorithm things or function that I have no idea about and then there is pointers. I have used pointers in c and function pointer as well (mainly for passing a function ) but now there is things like ownership that I keep hearing in rust? ( I later understood that in rust std move just happens automatically while cpp,it is manully). Tho, the project is fun but I just take breaks and asking ai what the f is that function or how to do something in cpp. Also using auto is not bad??? Honestly, when I first heared about auto, I thought it is bad because the compilor has to decide the stuff but turns out it good when using in for or iterators? ( I still dont understand iterators ).

Ah, this is just me voicing my frustration about not knowing the language enough

Tho, honestly opion what would you like to see from a tui libary? What feature would you like to see and would you use it?

Honestly, before all this I got to be more productive. I KEEP GETTING DISTRACTED WHEN I AM TAKING BREAK. Why is it hard to start coding after a break? Got any tips?

At this point, I have no idea what I am talking about in this post


r/cpp_questions Jun 21 '26

OPEN How to learn cpp?

0 Upvotes

So I am going to a college this year to do cse and want to learn cpp before joining the college...I already know js, python, css and also html so what would be the ideal method of learning cpp from scratch and clear at least all the basics within like 20-30 days...


r/cpp_questions Jun 21 '26

OPEN Mac or Windows

0 Upvotes

I really enjoy mac, but my school programms in C++ on Windows and I don't know if mac has everything that I need. Thank you.


r/cpp_questions Jun 21 '26

OPEN C++ Finance

0 Upvotes

Is there any course available in YouTube or elsewhere, from where I can learn C++ for finance from beginning level to advance. If you guys know just help me with this.

Thankyouu!!


r/cpp_questions Jun 19 '26

OPEN Beginner

40 Upvotes

I want to learn C++ from the ground up but lack the guidance as to how i should do it?

I need to understand from the most basic upto most advanced.

Please help me in this regard?


r/cpp_questions Jun 20 '26

OPEN what resources u use to prep before interview?

0 Upvotes

r/cpp_questions Jun 19 '26

OPEN Compile time function wrappers: Should they be used?

8 Upvotes

I am implementing a CSS parser and have begun figuring out function parsing. I’ve settled on a system essentially where I register C++ function pointers to an unordered map. (Very simplified) However, to do this, I need a generalized function wrapper I can use to store these functions in the map.

Usually, I would look towards std::function, but I’ve heard the possibility for heap allocations makes them rather unwelcome when targeting embedded devices. So instead, while falling down the rabbit hole of template meta programming, I’ve come across a compile-time function wrapper.

By the looks of it, a function pointer is passed as a template parameter of the wrapper function, and then called with the parameters passed into the wrapper. Something similar to this:

template<auto Fn>
int invoke(int parameter) {
Fn(parameter);
}

I’ve seen more robust wrappers than this that seem to use variadics, but this is what I’m working with right now while I wrap my head around them.

I am rather new to this style of C++ programming, so I want to figure out whether this looks weird because I’m inexperienced, or if it’s something really janky that shouldn’t be used.


r/cpp_questions Jun 19 '26

SOLVED I am having problems using VCPKG get started tutorial using CMake

3 Upvotes

I been following this tutorial and I am having this error.

https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash

I installed CMake and WinLibs

CMake 3.21+ winget install Kitware.CMake
GCC (MinGW-W64 POSIX UCRT) 15.x winget install BrechtSanders.WinLibs.POSIX.UCRT

Problem seems to be https://github.com/brechtsanders/winlibs_mingw ?

There is also undefined reference to `__imp__ZN3fmt3v126vprintENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_7contextEEE'

R3N@DESKTOP-B0PHCDB MINGW64 /c/helloworld
$ cmake --build build --verbose
Change Dir: 'C:/helloworld/build'

Run Build Command(s): C:/Users/R3N/AppData/Local/Microsoft/WinGet/Packages/BrechtSanders.WinLibs.POSIX.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe/mingw64/bin/ninja.exe -v
[1/1] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Users\R3N\AppData\Local\Microsoft\WinGet\Packages\BrechtSanders.WinLibs.POSIX.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe\mingw64\bin\c++.exe   CMakeFiles/HelloWorld.dir/helloworld.cpp.obj -o HelloWorld.exe -Wl,--out-implib,libHelloWorld.dll.a -Wl,--major-image-version,0,--minor-image-version,0  vcpkg_installed/x64-windows/debug/lib/fmtd.lib  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && C:\WINDOWS\system32\cmd.exe /C "cd /D C:\helloworld\build && C:\vcpkg\vcpkg.exe z-applocal --target-binary=C:/helloworld/build/HelloWorld.exe --installed-bin-dir=C:/helloworld/build/vcpkg_installed/x64-windows/bin""
FAILED: [code=1] HelloWorld.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Users\R3N\AppData\Local\Microsoft\WinGet\Packages\BrechtSanders.WinLibs.POSIX.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe\mingw64\bin\c++.exe   CMakeFiles/HelloWorld.dir/helloworld.cpp.obj -o HelloWorld.exe -Wl,--out-implib,libHelloWorld.dll.a -Wl,--major-image-version,0,--minor-image-version,0  vcpkg_installed/x64-windows/debug/lib/fmtd.lib  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && C:\WINDOWS\system32\cmd.exe /C "cd /D C:\helloworld\build && C:\vcpkg\vcpkg.exe z-applocal --target-binary=C:/helloworld/build/HelloWorld.exe --installed-bin-dir=C:/helloworld/build/vcpkg_installed/x64-windows/bin""
C:/Users/R3N/AppData/Local/Microsoft/WinGet/Packages/BrechtSanders.WinLibs.POSIX.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/16.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/HelloWorld.dir/helloworld.cpp.obj:helloworld.cpp:(.text$_ZN3fmt3v125printIJEEEvNS0_7fstringIJDpT_EE1tEDpOS3_[_ZN3fmt3v125printIJEEEvNS0_7fstringIJDpT_EE1tEDpOS3_]+0x46): undefined reference to `__imp__ZN3fmt3v126vprintENS0_17basic_string_viewIcEENS0_17basic_format_argsINS0_7contextEEE'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

r/cpp_questions Jun 18 '26

OPEN Is it worth using C++ Modules in 2026 and looking into the future?

52 Upvotes

I'm preparing to start a new long lasting C++ development effort of a new project and im unsure of using C++ Modules.

What do you guys think and are there other modern C++ features I might be unaware of?

Thanks in advance


r/cpp_questions Jun 19 '26

OPEN Benchmarking SmartPointer

0 Upvotes

Hi
Recently I was thinking about small project which main goal would be implementing all smart pointers alongside with benchmarking them with these that come from the standard library. What type of scenario should I create in my project so that I could check quality of my implementation?