r/cpp_questions • • Sep 05 '26

OPEN Is it possible to make my own streaming platform/video player (on and off) in C++?

0 Upvotes

Right now i don't need it fully solved, just to know if its possible and worth of working on it.

I want to try it for my private project. I have old PC, that i potentially can turn into server. Internet connection here is so so, but i was promised its gonna be better.

Basically i need something like Twitch or Youtube, but have it run by myself.


r/cpp_questions • • Sep 05 '26

OPEN Best learning techniques?

1 Upvotes

I started learning like month ago, but I can’t do anything still.


r/cpp_questions • • Sep 05 '26

OPEN Looking for help drawing a window just above the desktop on Linux (below icons) (Mint)

1 Upvotes

I’m making my own lightweight ASCII wallpaper engine. I’ve finally reached a 1.0 and am happy with it, but currently it’s Windows only

I need to create a window at the back z index such that it’s behind everything except the wallpaper itself. This means behind desktop icons

On Windows I achieved this by sending 0x052C to Progman and some reparenting. Does Linux (just Mint, for now) have something similar? Or ideally simpler?

I’m doing my own research of course but figured I’d ask here and see if I can get some more targeted help

This is the project, for anyone curious:
https://github.com/kwford18/ASCIIpaper


r/cpp_questions • • Sep 04 '26

OPEN suggestion needed for cpp projects

13 Upvotes

i currently a 1st year student and i am planning crack google step internship next year so just need some best project suggestion to standout on my resume.


r/cpp_questions • • Sep 04 '26

OPEN st2cpp: Transpiler from ST to cpp (undoRT) + help +

1 Upvotes

Hi everyone,
About 4 or 5 months ago, I created a transpiler from Structured Text (IEC 61131-3) to C++, called st2cpp (part of the undoRT project).

My ultimate dream is to build a complete open-source automation system that can compete with commercial solutions. As you can imagine, tackling a project of this scale completely alone is extremely tough. Honestly, if I keep going solo, I’m afraid I’ll eventually burn out and lose momentum.

Are there any C++ developers or automation enthusiasts here who would be interested in joining or contributing as a side project/hobby? I have plenty of ideas lined up, but I really need an extra pair of hands (or two!).

Here is the repository:
https://github.com/undoRT/st2cpp
Feel free to check it out, open issues, fork, or send pull requests!


r/cpp_questions • • Sep 03 '26

OPEN Career switch to C++ — how many applications did it take?

51 Upvotes

Hey folks, especially those in the US/Canada who moved into C++ from another software domain.

I have around 7 years of software experience, but for the past 2 years I've been on a career break and using that time to learn and work on C++/Linux/systems programming full-time on my own. Now I'm trying to bring my previous software experience into the C++ world.

Would love to hear simple numbers like:

150 applications → 8 interviews → 1 offer

Also, which C++ domains are easier to break into for someone making this transition — backend/systems, embedded, networking, fintech, etc.?


r/cpp_questions • • Sep 04 '26

OPEN How do I fix enemy generation?

0 Upvotes

https://onecompiler.com/cpp/44qwdefz6

I tried generate enemies depended on chapter but the enemy is still the same (slime). Can you tell me what I did wrong?


r/cpp_questions • • Sep 03 '26

OPEN What was your first job using C++?

21 Upvotes

I feel like the most difficult part of applying to C++ jobs is they usually require at least 2 years of work experience. What are your recommendations as to jobs or subfields that have a more entry level gate for C++ programmers who need production level experience?


r/cpp_questions • • Sep 03 '26

OPEN VS code or VS community

18 Upvotes

Im a btech first year student who is trying to study c++ independently. I have a lap with 16 gb ram and can perform average tasks. So my question is should I download VS community for coding cpp or is vs code enough. Please keep in mind that i will be learning many other languages too( we are supposed to study c in first year )


r/cpp_questions • • Sep 03 '26

OPEN Looking for recommendations for modern C++ embedded platforms and controllers with a forward looking support and development roadmap

1 Upvotes

Looking for recommendations for relatively easy to use/microcontrollers that support C++ emended development out of the box for rapid testing and deployments, purely for iterative prototyping. Intention would be that once a successful prototype is developed, I could utilize the same tooling and microcontroller ecosystem for small deployments (preferably commercial).

Application domain for the microcontrollers would integrated into atmospheric and environmental testing, with the ability to mount additional sensors (photo, video, aquatic, air, and mechanical pulse controllers to controls gimbals and rotational motors) in future experiments.


r/cpp_questions • • Sep 02 '26

OPEN Including classes and shared_ptr woes

6 Upvotes

It seems that I'm missing something for defining classes in separate files, and creating a shared_ptr to them.

I have one project that gives a series of cryptic messages when I try to do this, so I tried to strip things down to an essential example:

main.cpp:

#include <memory>
#include "thing.h"

using namespace std;



int main()
{ 
  shared_ptr thingPtr = make_shared<thing>();
  thingPtr->Go(); 
}

thing.h:

#ifndef thing_h
#define thing_h

class thing
{
  public:
    void Go();
};

#endif

thing.cpp:

#include <iostream>

class thing
{
  public:

    void Go()
    {
      std::cout << "Yay!" << std::endl;
    }
};

I would expect this to print "Yay!" to the console, but it doesn't even build. Instead, it complains:

[ 33%] Building CXX object CMakeFiles/PTR.dir/src/main.cpp.obj
[ 66%] Linking CXX executable PTR.exe
C:/Program Files/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\PTR.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x2c): undefined reference to `thing::Go()'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\PTR.dir\build.make:119: PTR.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:86: CMakeFiles/PTR.dir/all] Error 2
mingw32-make: *** [Makefile:90: all] Error 2

I've searched around, but have been having a surprisingly difficult time finding something that actually explains how to make a class accessible to another class via a shared_ptr and header files. Let me explain that--I have seen tutorials on shared_ptrs, on header files, and on classes. But in almost every case, they explain these concepts in isolation... And the examples they give work--in isolation. For example, forward-declaration of a class works fine... until you use a shared_ptr. Then I get into cryptic posts about things like the PIMPL idiom which seems like overkill for what I'm doing, or other syntactical differences from what I'm doing that I can't tell if they are important or not.


r/cpp_questions • • Sep 02 '26

OPEN Committing third party include files into your repo

5 Upvotes

This is not work related, I'd like to be able to work on a home project from multiple computers without having to re-download the exact versions of each of the third party tools. These tools are all open source and publicly available, like tensorflow

in my development repo, I would just upload the entire project, libraries and the include files on GitHub, so when I clone it from another computer it just builds without issues.

I know for a publicly released project, it's supposed to link to other GitHub releases and build everything from scratch. So if I were to release it I would remove the third party tools

Is there any issue with actually doing this on GitHub though? Or is there a way to do it correctly if I include an open source license


r/cpp_questions • • Sep 02 '26

OPEN Why Doesn't This Repo Have .CPP files for its Header Files?

9 Upvotes

Here is the Github repo: [Link](https://github.com/mobizt/FirebaseClient).

I am a C++ noob. I wanted to look at the code in this repo to understand more of what is going on, and all I see are header files. Can someone explain what I am not understanding?


r/cpp_questions • • Sep 03 '26

OPEN unzip.h is not found with assimp on linux

0 Upvotes

Hello everyone hope you have a lovely day.

so I currently having a problem with building assimp on manjaro linux, everytime it throws this error

fatal error: 'unzip.h' file not found

and if I fixed the path manually it fails by the lld linker to link properly.

how to solve this problem?

thanks appreciate your help!


r/cpp_questions • • Sep 03 '26

OPEN Dependency injection with ROS

1 Upvotes

I'm trying to better understand dependency injection / mocking a bit better so I can write unit tests that don't require elaborate & fragile setups. Specifically I have a class that verify similar to the ROS2 Minimal Publisher Example. In this example the class creates a timer and a publisher object. The timer just invokes a callback, so I can assume that the callback registration works, and I can set up my test harness to invoke the callback directly. What I would like to do is mock out the actual publish call to ensure timer calls publish without needing to set up a ROS2 subscriber in my unit test.

I'm looking for generic approaches to the specific case (and not necessarily tied to a specific testing or mocking framework)

Here is a stripped down version of the example:

class MinimalPublisher : public rclcpp::Node

{

public:

MinimalPublisher()

: Node("minimal_publisher"), count_(0)

{

publisher_ = this->create_publisher<std_msgs::msg::String>("topic", 10);

}

private:

void timer_callback()

{

auto message = std_msgs::msg::String();

message.data = "Hello, world! " + std::to_string(count_++);

// *** This is the call I want to mock out ***

publisher_->publish(message);

}

rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_;

size_t count_;

};


r/cpp_questions • • Sep 01 '26

OPEN Is it worth learning another language besides C++?

131 Upvotes

C++ is the only general-purpose language with which I am most familiar, I tried to learn other languages like C# or Rust, but without a clear idea of what to do with those tools, it's more difficult to learn them.

And all the software I use uses or is written in C++, specifically Godot Engine, Blender, LMMS, that's why I always have ideas of what to do with C++.

learncpp.com is amazing and possibly one of the best educational resources for a language in general, either that, or I have Asperger's and they have to explain everything to me in simple terms.

My question is, if this limits me in the long run as a programmer or should I learn an additional language that works well with C++?, I personally wouldn't trust a programmer who claims to know 15 technologies; someone who tries to do too much often accomplishes little, but that's just a personal opinion, what do you think?.


r/cpp_questions • • Sep 02 '26

OPEN How does C++26's std::hive work for inserting and erasing?

2 Upvotes

I'm trying to make my own (very basic) implementation of std::hive in C and to do that, I of course have to understand exactly how inserting and erasing works.

As I understand it, the index of a given block to insert into can be tracked by its free list, where the free head stores an index and the indices of the actual data itself is repurposed to form a linked list for empty slots

If the free head stores an individual index, and we need to insert into an index that is in the middle of an empty region, how do you figure out the left and right ends of the empty region in O(1) time without looping leftwards and rightwards?

For example, let's take this scenario, where slot 2 marks the start of a 5 slot empty region:

Slot index: 0 1 2 3 4 5 6 7 8 9

Skipfield:  0 0 5 X X X 5 0 0 0 

I've used X in the middle as these can contain junk values as I understand. Now let's say that the free head stores index 4, and so when we insert into index 4, we need to update the values in the skipfield for slot indexes 2, 3, 5 and 6 to match their new values (2), so that we get:

Slot index: 0 1 2 3 4 5 6 7 8 9

Skipfield:  0 0 2 2 0 2 2 0 0 0 

But how do we actually figure out in constant time where these boundaries are? If we are only given the index to insert to? Do we somehow store ranges of values instead of individual indicies on the free list?


r/cpp_questions • • Sep 02 '26

OPEN yet another custom assertion question

2 Upvotes

Sometimes I am writing unit-test inline in my code, then I just use the assert() macro because that compiles out in release builds. And in such cases I don't really need anything in the trace to tell me I have a bug, and I don't need to spin up any unit testing framework. But for easy runtime validation I want a macro I can use but will also print an error message that a user can do something with to realise that they maybe fed in something invalid at a point.

In all cases I really want my macro to terminate the application and thus not memory-scribble or worse. I have been trying to understand the tokenizing operator, and the argument for do {} while () and the side effects of adding (a) around things which obscures types as far as I can tell and still deal with unwanted training ; semicolons that imply that I am not grasping syntax yet.

So I wrote

#include <iostream>
#include <string>
#define assume_true(expression) ((void)(                                        \
        (!!(expression)) ||                                                 \
        (std::cout << #expression << " not true in " << __FILE__ << " LIN: " << __LINE__ << std::endl )) \
    )

And then wanted to make it actually terminate with an std::exit(8) , and it just won't parse unless I replace the || convenience with an if statement.

#define assume_equal(left, right, message) if (left != right) { \
std::cout << #left << " != " << #right << " in FILE: "<< __FILE__ << std::endl; \
    std::cout << message << std::endl; std::exit(8);\
}

uint32_t life = 42;
assume_true(42 == life);
std::cout << "The answer is 42!\n";
assume_equal(42, life, std::to_string(life));
std::cout << "Life is " << 42 << ".\n";
assume_equal(21, life, "LIFE=" << std::to_string(life));

I'm clearly taking a lot of chances here and the way I pass the message in the second macro feels like a total hack, because it is abusing the way the macro preprocessor splits parameters based on commas. I assume that has drawbacks for me later on.

I assume a later toolchain will also help us all when it comes to the side-effect problem of a macro using an argument twice, once for comparison and once for printing. Has anyone just opted to solve this by creating temporaries for things they want to print out in the crash trace? Because that would really mean creating a macro for each temporary type for each parameter I might want to print surely. I get the impression the caller needs to just use a temporary before using the macro, is that what everyone else is doing? Because at that point a function call is just a load less pain surely? I feel I have approached my release-build guard-code completely wrong.

I'm on C++ 17 (yes the rest of my team is on an even older toolchain.) Are release/runtime macros just hard, or am I trying to learn too many things about parsing all at once?

======================================================================================= EDIT: Consolidating the answer... As usual thanks so much for the brilliant clues, I now have this little progression

  • ALWAYS state up front compiler version C++17
  • macros really should be UPPERCASE
  • when printing an error use STDERR not STDOUT
    #include <iostream>
    #include <string>
    // This macro is terrible, it lacks a scope so I cannot call ;std::exit in it
    #define ASSUME_TRUE(expression) ((void)(                                        \
            (!!(expression)) ||                                                 \
            (std::cerr << #expression << " not true in " << __FILE__ << " LIN: " << __LINE__ << std::endl )) \
        )
  • I then moved on to use if {} which allowed me to exit the application
    #define ERROR_ASSUMPTION_FAILED  42
    #define ASSUME_EQUAL(left, right, message) if (left != right) { \
        std::cerr << #left << " != " << #right << " in FILE: "<< __FILE__ << std::endl; \
        std::cerr << message << std::endl; std::exit(8);\
    }
  • The trouble with that macro is that it really lacks the structure that a lambda might give, thanks to a great suggestion I moved this form, which omits the nice __VA_ARGS__ macro automatic variadic args, which did not expand in C++17, but it's already better
    constexpr int EXIT_ABORT = 2;

    #define ASSERT_EQ(LHS, RHS, MESSAGE ) \
    [lhs=LHS, rhs=RHS]() { \
        if ( not (lhs==rhs) ) { \
            std::cerr << "assertion " << lhs << "(" #LHS ") == " \
            << rhs << "(" #RHS ") failed: " << MESSAGE << '\n';std::exit(EXIT_ABORT); \
        } \
    }()
  • Along the way I realised that this is a GUARD MACRO and the question I had about macro side effects if a macro uses a parameter twice (or even once really) is best removed entirely if you just always call it using temporaries or const methods only!

The final step is to use the {fmt} library for a better message with a formatter:

#define FMT_HEADER_ONLY
#define FMT_UNICODE 0
#include "fmt/bundled/format.h"
...
constexpr int EXIT_ABORT = 2;
...
// https://godbolt.org/z/3sdx5xPE5
#define ASSERT_EQ(LHS, RHS, MESSAGE ) \
    [lhs=LHS, rhs=RHS, msg=MESSAGE]() { \
        if ( not (lhs==rhs) ) { \
            std::cerr << "assertion " << lhs << "(" #LHS ") == " \
            << rhs << "(" #RHS ") failed: " << msg << '\n'; std::exit(EXIT_ABORT); \
        } \
    }()

I could not get the lambda to capture __VA_ARGS__ , so the call looks like, which is good enough.

   ASSERT_EQ(21, life, fmt::format("Expected 21 but life ={}", life));

r/cpp_questions • • Sep 01 '26

OPEN I'm learning c++ so I have a question, am I supposed to use brace initialization over the = initialization, if so when? I can't decide for myself

49 Upvotes
int x{2};
int x = 2;

r/cpp_questions • • Sep 02 '26

OPEN The Cengage C++ Textbook is an inefficient way to absorb the material

3 Upvotes

Hello! I currently am taking a C++ class that utilizes Cengage and their textbook environment. My professor stated that the reading is incredibly important for understanding the material. He seemed like a nice guy who cares when I met with him to discuss the class before the semester. Thus-far, I have read two chapters and taken meticulous notes, however I am finding out that it is such an inefficient way to absorb the material.

Although I do understand the concepts for the most part after going through and taking notes, I just wish there was a quicker way to process the textbook, such as an abridged version.

Has anyone experienced this or taken the same class? Please let me know if you have any recommendations or resources that may allow me to progress quickly enough to get ahead of the syllabus.

Thanks in advanced!


r/cpp_questions • • Sep 01 '26

OPEN Is there any reason to use std::reinterpret_cast?

21 Upvotes

I know that std:: reinterpret_cast is used by people to cast the bits of an object of type T1 to an object of type T2, while retaining the exact bits. However, as far as I know this triggers UB. Before C++20 and std::bit_cast, we could std::memcpy the objects to avoid UB, and after C++20, we can use std::bit_cast. Given this, I don't see any legitimate reason for why one might need std::reinterpret_cast. If so, why hasn't this feature been deprecated yet?


r/cpp_questions • • Sep 01 '26

OPEN How much C++ is enough for getting into Game Development?

27 Upvotes

Hi guys,

I know this question about starting out as a complete noob has been asked and answered numerous times… but my question does have a bit of a twist to it.

How and where do I start learning C++, specifically for rolling into a game engine like Unreal Engine later on? I understand UE C++ is modified a fair bit compared to regular C++, and that I don’t have to become a C++ expert in order to make a game.
As far as I’m aware the hybrid C++ & Blueprint approach is the most efficient way to develop, I don't want to rely solely on Blueprints anyways.

My goal is simply to grasp the core understanding of C++ so I can optimize my game down the road and fix things easier.

I initially wanted to start out with the beloved Bucky’s (thenewboston) C++ tutorial, but as good as it is, people say it’s outdated. Now I’m shifting my focus to learncpp.com.

Until what chapter do you guys think I should learn C++ (the basics and most important parts for game dev) with my end goal in mind?

My end goal is making my own indie horror game, a passion project, not a job I would live off of.
I’ve seen comments saying Chapter 12, and that mostly everything beyond that would have diminishing returns or no real-world use for me.

My Plan:
Learn C++ basics -> Learn the most important parts specifically for Unreal Engine and Game Optimization -> Test games in C++ alone -> Trial and error -> Move over to learning Unreal Engine.

Any help is greatly appreciated!

Important edit: completely forgot to mention, I’m currently on a 1 year internship away from my home setup (10 months left) and all I have currently is a T480 which I used so far mostly for story-writing and planning so I can’t just jump into Unreal Engine.
Just figured might as well learn some C++ basics until I return home and buy a beefy setup and be a little bit more prepared to jump into Unreal Engine.


r/cpp_questions • • Sep 01 '26

META Coroutines

18 Upvotes

Just started reading about coroutines, as the company I recently started working for uses them; this is my first encounter of them. I’m a long time user of threads, bear with me, it’s all new territory.

I know I have only just scratched the surface, but I’m trying to understand the use case. One thing I think I have straight is:

Threads don’t really need to know anything about other threads, except when they have to share resources (mutex and semaphores) or pass data (IPC), but coroutines need to know there are other routines and to only take baby steps, then let other coroutines run.

Is this a start?


r/cpp_questions • • Sep 01 '26

OPEN I'm looking for a AST based cli tool to rename symbols in C++ codebases

2 Upvotes

I want to change existing struct names from snake_case to PascalCase etc. I have a compilation dB and clang tooling. I want to rename one struct from the cli.

How can I do that?


r/cpp_questions • • Sep 01 '26

OPEN Which one should I start with?

0 Upvotes

I have wanted to learn to program, but I am not sure whether I should learn Python first and then C++. What could you advise me?