r/cpp_questions • • 12d ago

SOLVED Best book for OOP in C++17 and beyond?

16 Upvotes

So a lot of people suggested I learn from a book,which I like cause reading is the way I actually learn stuff,allng with then testing what I read. Some books were mentioned but I want to know if there are any other good ones.


r/cpp_questions • • 12d ago

OPEN Best traditional resources to truly learn proper, cross-platform, desktop app dev with C++?

6 Upvotes

I have an extensive SWE career, across several platforms and tech stacks (Unity/C# -> iOS/Swift ~> Vue/Node/TypeScript), though given the adverse challenges, extreme competition, and/or growing lack of opportunities, I've been thinking about specializing on something lower-level, more serious and demanding, and which may lead me to a more secure and valued job for a considerable time.

I have Mozilla, and particularly Firefox development in mind, given that it's the app I use the most everyday, that I value the foundation's mission and modus operandi, that they have and might still have open job positions in the upcoming months, and that C++ is still at the core of serious app dev, and hopefully not as prone to waver by the reckless impact of gen. ai.

That said, besides the official reference, which I'll definitely read through for starters, while writing pieces of code to put the concepts into practice, and of course, by forking the Firefox (and similar) repos, start delving into them, and eventually trying to fix bugs, which other resources, approaches, tools (not ai-driven), etc., would you recommend me to channel the learning toward the goal I have in mind?

Edit: or courses, perhaps? For instance, back in 2019 I learned a ton on iOS dev, which helped me secure the first related job, thanks to Paul Hudson's Hacking with Swift.


r/cpp_questions • • 12d ago

OPEN what is the best tool for coding in c++ aside from vscode on linux

16 Upvotes

r/cpp_questions • • 12d ago

OPEN Opions about the book: C++ How to Program 11e (up to C++23) of Deitel

5 Upvotes

https://deitel.com/c-plus-plus-how-to-program-an-objects-natural-approach-11-e/

I've seen so many posts asking which C++ books or tutorials people should read, and almost all of them receive the same recommendation: learncpp.com. However, I've never seen anyone mention this book. Why is Deitel's C++ How to Program rarely recommended?

I skimmed through the table of contents, and it seems quite comprehensive. I've also read some of the chapters, and they're pretty straightforward. It covers some topics that aren't discussed on learncpp.com, such as concurrency and metaprogramming.

The only downside is the text colors, which are a little bit gaudy.

What are your thoughts on this book? Would you recommend it to beginners and intermediate learners?


r/cpp_questions • • 13d ago

OPEN What should I build or learn next in C++?

18 Upvotes

About 6 months ago, I asked here how to approach modern C++ after learning mostly C++11 at university.

Since then, C++ has become my favorite programming language. I've also grown to really enjoy C.

Now I'm looking for a new challenge. I'd love to explore systems programming and build something interesting, perhaps a compiler, a small operating system or something completely different.

What projects or topics would you recommend exploring next?

Thanks!


r/cpp_questions • • 14d ago

OPEN Which graphics library could you recommend?

31 Upvotes

I am buidling my own game engine, but im not sure which graphics library to use. i think using pure OpenGL might be too hard for me, i like the raylib examples but out of the box it looks a bit too stylized to the raylib theme, so is it possible to make it look the way you want? What about SDL, whats the developer experience with that?


r/cpp_questions • • 14d ago

OPEN Where to start learning C++?

22 Upvotes

Hi everyone! I want to start learning C++, but I’m not sure where to begin. As my first goal, I plan to build a simple 3D viewport to understand how everything works in practice. Could you please advise on where a beginner should start?


r/cpp_questions • • 14d ago

SOLVED How to learn c++ effectively and be profficient in it?

43 Upvotes

Maybe you've heard this question before, but I want to know. I've been studying c++ for a month now, and I feel like I know some of the basics, but I know that I need a different approach. I feel like I just memorize it instead of getting it. I want to learn it truly,the right way. I write a lot of code cause I know thats the best but I fall short on the thinking like a programmer part. I want to lean c++ independently,then switch to ue5 and work on a game. I would love it if you would share your methods and links to some good c++ literature. I know I'm not dumb and I know it's not easy. I am not looking for a quick solution, just the right one.


r/cpp_questions • • 14d ago

OPEN How to get the unblurred backdrop behind a window for a refraction shader? (Win32, Windows.UI.Composition)

1 Upvotes

I'm building a macOS style dock for Windows as a side project. It's plain Win32 C++, one exe: https://github.com/Moryel/JustBetterTaskBar

The dock background is frosted glass right now. It's a window with WS_EX_NOREDIRECTIONBITMAP, a DesktopWindowTarget, and a sprite visual whose brush is a HostBackdropBrush with a saturation effect on top. Trimmed down, it's this:

```cpp
HWND wnd = CreateWindowExW(WS_EX_NOREDIRECTIONBITMAP | WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_NOACTIVATE,
L"GlassWnd", L"", WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, hinst, nullptr);
BOOL t = TRUE;
DwmSetWindowAttribute(wnd, 17 /*DWMWA_USE_HOSTBACKDROPBRUSH*/, &t, sizeof t);

auto interop = compositor.as<ABI::Windows::UI::Composition::Desktop::ICompositorDesktopInterop>();
winrt::check_hresult(interop->CreateDesktopWindowTarget(wnd, true,
reinterpret_cast<ABI::Windows::UI::Composition::Desktop::IDesktopWindowTarget**>(winrt::put_abi(target))));

auto visual = compositor.CreateSpriteVisual();
auto geo = compositor.CreateRoundedRectangleGeometry();
visual.Clip(compositor.CreateGeometricClip(geo));
target.Root(visual);

auto backdrop = compositor.CreateHostBackdropBrush();
winrt::Windows::UI::Composition::CompositionEffectSourceParameter src(L"backdrop");
auto fx = winrt::make<SaturationEffect>(1.8f, src); // custom IGraphicsEffectD2D1Interop
auto brush = compositor.CreateEffectFactory(fx).CreateBrush();
brush.SetSourceParameter(L"backdrop", backdrop);
visual.Brush(brush);
```

That works fine. What I want now is something like Apple's Liquid Glass: lighter blur, and the content behind gets bent near the edges like a lens.

The problem is that HostBackdropBrush already gives me the backdrop blurred, so there's nothing sharp left to displace. I also couldn't find a displacement effect that CreateEffectFactory accepts.

These are the two options I can see:

  1. Capture the monitor area under the dock with Windows.Graphics.Capture and set WDA_EXCLUDEFROMCAPTURE on my own windows so they don't show up in it. Then run my own D3D11 pixel shader on the captured texture for the blur, the edge displacement and a rim highlight, and present it through a swap chain. My worries here: memory probably goes from ~12 MB to 40-60 MB, the yellow capture border might show up on some setups, and a constant capture loop just feels heavy for something that's always on screen.
  2. Skip real refraction. Keep the HostBackdropBrush and just draw highlights and gradients on top. Cheap, but it only looks "kind of" like it.

My actual questions:

- Is there any way to get the unblurred backdrop from DWM or Composition without capturing the screen myself?
- If capture is the only way, is running Graphics.Capture continuously in an always-on-top window reasonable performance-wise? Has anyone done it?
- And can the capture border be turned off reliably for an unpackaged Win32 app?

Thanks in advance.


r/cpp_questions • • 14d ago

OPEN Looking for C++17 API design feedback on my networking library

0 Upvotes

I've been developing LightnerX, a C++ networking library built on top of GameNetworkingSockets.

I recently migrated it from C++26 modules to C++17, which required reorganizing the public API into traditional headers and source files.

The library provides client-server networking, connection management, message batching, and an interpreter for a small semantic communication protocol called INER.

I'm trying to improve the API before adding more features, particularly in three areas:

Resource ownership: Client and Server manage their networking lifecycle, while applications control initialization, updates, and how components interact.

Error handling: Operations return lightnerx::Result, allowing callers to inspect failures without relying on exceptions for ordinary networking errors.

Modularity: Networking, connection management, and message interpretation are separate components.

I'm interested in whether these design decisions make sense from a C++17 perspective.

Are there any API patterns or ownership pitfalls I should reconsider? Would you approach error handling or component separation differently?

I'm not looking for a general project showcase. I'm mainly interested in feedback on the public interfaces and design.

Relevant headers: https://github.com/pietroth/LightnerX/tree/main/include/lightnerx

Any technical criticism is appreciated.


r/cpp_questions • • 15d ago

SOLVED Performance of std::vector

33 Upvotes

In the university we had to implement quicksort, the unsigned ints are stored in std::vector. I have accidentally discovered, that all algorithms, despite how students implemented them, are much faster when instead of directly accessing data from the vector like that:

arr[n]

we write:

unsigned int *a = arr.data()

and access that data by writing:

a[n]

But I can't understand why is that, in both cases it translates to one and the same: *(a + n)

The code is compiled on Clion IDE if that changes anything, no custom settings for compilation are used.

I can't directly share the algorithms for copyright reasons as they are not mine.


r/cpp_questions • • 15d ago

OPEN Is there any free interactive learning like rustlings/ziglings for cpp?

19 Upvotes

I find rustlings/ziglings to be really strong at helping me learn concepts and have it stick.


r/cpp_questions • • 15d ago

OPEN What is the best way to learn C++ for control theory implementation? Should I learn python or C++?

3 Upvotes

My background:

I'm a 5th year mechatronics engineering student that is good with matlab/simulink and is looking to expand my skills for my future career in automation/control/robotics.

I already know the basics of C++ from the course I took in college. Also, I am pretty good at 86 assembly programming. I heared that python is only used for simulations but that is what I use matlab/simulink for.


r/cpp_questions • • 15d ago

OPEN Looking for a beginner-friendly C++ book

2 Upvotes

I recently decided to dive into programming, and I picked C++ as my first language. I realize it's a tough and complex language, but I'm drawn to it because I find it really fascinating.

That said, I'm wary of getting overwhelmed by the advanced topics right from the start and ending up in a tutorial loop where I'm just stuck learning without actually creating anything.

With that in mind, I'm on the lookout for book recommendations that strike a balance, something that won’t bury me in every intricate detail, but will still help me learn enough to work on some cool and practical projects.


r/cpp_questions • • 15d ago

DISCUSSION Why C++?

0 Upvotes

C++ is a general-purpose, performance-focused programming language used across many different fields, and I'm really enjoying learning it. However, I keep seeing a lot of experienced developers criticize it heavily. Linus Torvalds famously trashed the language, even calling it a "horrible language":

"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much, much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do nothing but keep the C++ programmers out, that in itself would be a huge reason to use C."

He basically called C++ developers idiots. Even though he made this comment years ago in 2007, to be exact, it's starting to make me doubt my choice. And it's not just Linus; other tech pioneers and plenty of people on Reddit talk negatively about C++ as well. Different people have different critiques about the language claims such as, it's memory unsafe, violates clean language design principles, and more.

So, are these critiques mostly aimed at older versions of C++, and did modern C++ (C++11 and beyond) actually fix these issues? What are your thoughts?


r/cpp_questions • • 16d ago

OPEN Which book is the best for learning systems programming and low level in Modern C++ (17/20)

40 Upvotes

I have done some systems programming in C and C-style C++ with some operator overloading. But I want to learn Modern C++ (17/20) too and keep on doing systems programming along with low-level dev, which books do you recommend for me to follow?


r/cpp_questions • • 16d ago

SOLVED Confused between using learncpp or a book ? if book reccommed me the best ones

4 Upvotes

I have studied basic python in my high school , i have some foding knowledge and i know c till pointers , should i ue learncpp for learning cpp or any book , if bookplease give me the best ones


r/cpp_questions • • 16d ago

OPEN Bluetooth pairing

0 Upvotes

Guys am trying to have a Bluetooth manager(connect multiple device on one Bluetooth) work using cpp the thing is am not that good at cpp any recommendations. I tried using ai for advice but holy sh*t it's making it worse


r/cpp_questions • • 17d ago

OPEN Is this possible?

12 Upvotes

I’m working on a game engine as a way to learn C++ and CMake. I’m attempting to create an editor for my engine, and I want to use ImGui. I’ve been going back and forth about whether I want ImGui on the engine or editor, but I think I want it on the engine because the engine owns the main loop, so it can just do the imgui frame lifecycle stuff. Also, if I ever decide to learn Vulkan and switch to it (unlikely), I don’t think I’d need to update the editor.

The problem with putting it on the engine is that the game will now have ImGui and this code running each frame, not actually doing anything. I’m sure this has little to no impact on performance, but I feel like it’s unnecessary?

Anyways, I’m wondering if it’s possible to make it so that if I run the editor, then the ImGui code runs otherwise, it’s stripped out. I know there is conditional compilation I just don’t know if that is something that can be done in this scenario?


r/cpp_questions • • 18d ago

OPEN Is C++ worth it?

63 Upvotes

I've been wondering whether learning C++ would be worth it. I'm really interested in hardware design. I've even built my own CPU in Logisim, and now I'm looking to get into parallel programming and GPU computing.

I also enjoy programming highly efficient simulations and machine learning projects purely out of curiosity. Would C++ be a good investment for these interests, or would I be better off focusing on other languages?


r/cpp_questions • • 17d ago

OPEN Is C++ used outside of Unreal engine?

0 Upvotes

I feel like this is a really dumb question but I have been wondering if C++ is only used in game engines. I know godot also supports C++, but I saw some random comments mention that other companies like robotics or just other tech companies in general use C++ and now I'm really curious.

I'm currently in my first year of uni for game dev and we're learning blueprints atm, but I've been thinking of learning C++ in my spare time. After hearing about ue6 and verse, I got kinda nervous about the future of both blueprints and C++. I imagine a lot of companies will continue to use ue5, but if other industries use C++ it gives me a lot more opportunities, especially if I spend my next 3 years of uni being really productive with code and whatnot.

Thank youuu

Edit: Ok thank you everyone, I had no clue it's basically used for everything. All of your responses definitely make me feel a lot better regarding the opportunities I'll have when I graduate, as that was the main concern..

I'll get a head start on learning C++, very excited!!


r/cpp_questions • • 18d ago

OPEN how do header files work?

21 Upvotes

been trying to learn c++ recently, but ive been caught on header files. I have been told that they declare functions/variables, and including them basically makes the compiler copy/paste it above the code. however, i still dont quite understand it. How does the compiler know what to run in a function declared in a header file if there's no definition? My intuition tells me i need a .h file and a .cpp file along with the main file in order for it to work but i still dont understand how that would let the code run.

would i declare a function in the header file and then write the inside of the function in the cpp file?

like with the following code

//in blah.h

int sum(int a);

*********************

//in script.cpp

#include blah.h

int sum(int a)

{

return a+1;

}

******************

//in main.cpp

#include blah.h

#include <iostream>

int main()

{

std::cout << sum(1);

return 0;

}

*****************

would that compile?????????

and even so, how does the compiler read that?????

does it like know the declaration then search for the definition????


r/cpp_questions • • 18d ago

OPEN Rendering text through ImGui?

2 Upvotes

I'm hoping to get a basic repl running with ImGui, OpenGL, and GLFW. I'm comfortable with GLfW and OpenGL rendering but not the ImGui portion.

My question is, can I use the OpenGL context and the GLFW window and then get basic text editing functionality with just ImGui? No opengl buffers, no custom shaders. I think the opengl context needs a default vertex and fragment shader to function but I'm looking to keep that very minimal and handle basic repl input and text rendering between imgui::begin() and imgui::end(). A basic per keypress render loop where each GLFW key event updates a string and then ImGui renders a new frame for the window. I haven't worked with ImGui before. Do you think this is possible?


r/cpp_questions • • 18d ago

OPEN Learning to write video games from scratch

9 Upvotes

Hello everyone! This year I took a course on game development programming. I learnt alot of cpp basics, and eventually went on to write:

  • a couple classes from the Standard Templated Library
  • some trees and sorting algorithms
  • matrix and vector types for a raylib game (math as well)
  • a small raylib game with tanks
  • some enemy ai stuff such as pathfinding algorithims, a state machine & a behavior tree

eventually the course went into more Unreal Engine territory and I feel that as a C++ dev, it leaves alot to be desired. There's heeps I need to learn, and I want to also break it down to the basics before I go and write some more complex and large programs, but my end goal is write games basically from scratch, with the use of maybe some libraries at the very best. I do not enjoy or like the smell of game engines, since I do not know what is really happening underneath. I am trying to create a curriculum for myself for this coming year, of things to study on my own. Some ideas for what I want to do this year are: (in no particular order)

  • eventually create a 3D rendering engine (and understand the maths that makes it all work)
  • eventually write a minecraft clone (for learning purposes)
  • make some sort of RPG based heavily on this new game coming out on steam UNDERKEEP
  • and eventually.. become a C++ wise guy and make sellable games from scratch

does anyone have any suggestions, books, tutorials/guides, things to try and write, or communities to join, any suggestions at all? Thankyou!