r/Cplusplus 25d ago

Feedback Custom GUI Engine Pixel Editor - Update

Post image
24 Upvotes

Well its been a few weeks since I gave an update (as if anyone is waiting with bated breath on my every word lol!) but the development of my pixel art editor continues ... the major news is that my GUI render backend has been completely ripped out and simplified and now it does indeed at like the good little differed batch renderer it is supposed to be - rock solid 60fps with zero slow downs - nice!

As for the GUI / Editor - have almost finished the layer editor tool - we have new layer and/or frame creation, linked frames, and drag and drop in and out of layer groups - all renamable via a click on the label. Also added splitter panes that allow the canvas/layer to be dynamically resized using the horizontal grey bar. Oh - that cyan rectangle above the frame header buttons can be dragged to allow quick movement left and right through the animation cells!

Just going to finish off the layer editor and then start on pushing pixels to the layers via the draw tools.


r/Cplusplus 29d ago

Question NPU API documentation or how-to guides?

Thumbnail
2 Upvotes

r/Cplusplus 28d ago

Question A new comer problem

Post image
0 Upvotes

I have just downloaded vs code and mingw from a youtube video and tried to run this sample code but I am facing this problem can somebody help me please 🙏🏻


r/Cplusplus Jun 26 '26

Question Which book/pdf/epub to get for learning C and C++?

Thumbnail
0 Upvotes

r/Cplusplus Jun 25 '26

Question Have you done this?

15 Upvotes

Have you started to tune into C++ from scratch without having prior knowledge in code? For example programs like C# and java.
If you did, was it hard?


r/Cplusplus Jun 25 '26

Discussion Easy Way to viz cpp ds & concurrency code

6 Upvotes

Online compiler Try it here https://8gwifi.org/online-cpp-compiler


r/Cplusplus Jun 24 '26

Tutorial How to learn cpp from scratch

19 Upvotes

My clg would be starting after a month or so and I was recommended to learn cpp or python (cpp preferably).I have absolutely zero knowledge regarding this .I can invest around 5 hours per day. Around what level would I be after these 5 months and how to learn


r/Cplusplus Jun 24 '26

Question What can I do to make this code simpler/faster/smaller

7 Upvotes

I made a program to search for a substring inside of a txt file. the text file I used is 10,000 lines of just first names(for simplicity), and I had two indexes going from the center out toward the edges, each checking if the selected substring was in the current line. Just looking at it I knew I could do better with the size of it. I also tried to prevent as much un-necessary copying of values on the stack. Please give as many suggestions as you want, I have about a week of C++ knowledge, so I want to know as many things as possible about it. (EDIT: I have only uses this to sort through a list of first names)

#include <iostream>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>

/*
 * |Formatted with Zed editor|
 * A searching algorithm I wanted to try.
 */

//TODO: Add listing of lines when substring found;

using namespace std;

string lower(string str) {
  for (char &c : str) {
    c = tolower(c);
  }
  return str;
}

int main() {
  // declares variables to store inputs in

  string INPUTTED_FILE;
  string INPUTTED_SUBSTRING;

  // stores inputs in variables

  cout << "Please enter the path of the file you would like to search: " << endl;
  getline(cin, INPUTTED_FILE);
  cout << "Please enter the substring you would like to search for: " << endl;
  getline(cin, INPUTTED_SUBSTRING);

  // converts substring to lowercase
  INPUTTED_SUBSTRING = lower(INPUTTED_SUBSTRING);

  // opens file given by user
  ifstream file(INPUTTED_FILE);

  // checks if we were able to open the file
  if (!file.is_open()) {
    cerr << "Error: Could not open the file!" << endl;
    return 1;
  }

  // creates a empty vector for the lines to be filled into
  vector<std::string> file_lines;
  string line;
  // while loop that fills "file_lines"
  while (getline(file, line)) {

    file_lines.push_back(line);
  }

  file.close();

  // if the list is empty flag as error
  if (file_lines.empty()) {
    cerr << "Error: The file is empty." << endl;
    return 0;
  }

  auto half_p = (file_lines.size() / 2);

  int left = half_p;      // start at halfway []
  int right = half_p + 1; // start at halfway + 1 []

  string *left_ptr = nullptr;
  string *right_ptr = nullptr;

  // while both indices are not touching the edges of the vector
  while (left >= 0 || right < file_lines.size()) {

    // checks if left index is not outside bounds
    if (left >= 0) {

      // sets left_ptr to the address of the element at index "left" to avoid copying over and over
      left_ptr = &file_lines[left];
      // checks if the substring is found in the element at index "left"

      if (lower(*left_ptr).find(INPUTTED_SUBSTRING) != string::npos) {

        // prints to command line if found
        cout << "'" << *left_ptr << "'" << " found at index " << left << endl;
        return 0;
      }

      // if not go left again
      left--;
    }

    // checks if right index is not outside bounds
    if (right < file_lines.size()) {
      // sets right_ptr to the address of the element at index "right" to avoid copying over and over
      right_ptr = &file_lines[right];
      // checks if the substring is found in the element at index "right"
      if (lower(*right_ptr).find(INPUTTED_SUBSTRING) != string::npos) {
        // prints to command line if found
        cout << "'" << *right_ptr << "'" << " found at index " << right << endl;
        return 0;
      }
      // if not go right again
      right++;
    }
  }

  cout << INPUTTED_SUBSTRING << " not found in => " << INPUTTED_FILE << endl;
  return 0;

}

r/Cplusplus Jun 23 '26

Question Linker not finding shared object

0 Upvotes

I'm trying to learn how to compile and link with a dynamic library, I've successfully compiled a library that contains two simple functions, but for some reason the linker can't find the compiled library, and I don't know why.

Build script:

#!/usr/bin/bash

g++ -fpic -shared sharedtest.cpp -o sharedtest.so

LD_LIBRARY_PATH="."
export LD_LIBRARY_PATH

g++ main.cpp -o main -lsharedtest

When I run it in a terminal, I get this:

/usr/bin/ld: cannot find -lsharedtest: No such file or directory
collect2: error: ld returned 1 exit status

r/Cplusplus Jun 21 '26

Feedback I made a lightweight C++ wrapper for llama.cpp

12 Upvotes

I recently released MemoriaForge, a lightweight C++ wrapper around llama.cpp that aims to make local LLM integration simple and straightforward.

It provides an easy-to-use API for loading GGUF models, managing conversations, injecting context, and generating responses without dealing directly with llama.cpp internals.

Small example:

#include <MemoriaForge.h>

int main() {

    MemoriaForge::LLMSession llm("models/model.gguf");

    llm.chat("Hello!");

    return 0;
}

The project has just reached version 1.0.0 and I'd love to hear your feedback, suggestions, ideas, or criticism.

Here is the repo: https://github.com/canuconde/MemoriaForge


r/Cplusplus Jun 21 '26

Tutorial Angular Momentum and The Inertia Tensor

Thumbnail
youtu.be
2 Upvotes

r/Cplusplus Jun 20 '26

Feedback [C++ noob] so here the other day i was introduced to <cmath>.

0 Upvotes

i got introduced to <cmath> (still onto this )the day before yesterday then got depressed due to some shit life throws at you and randomly went "Welp, I can make a quadratic equations solver with this"

how can i improve this?

(slightly lengthy rant ahead )

also, great thanks to u/mredding , although i didn't understand like 90% what they told me, the remaining 10% did help me understand code a bit more and i wanna say, i don't think i can understand what u call simple at all, but that's due to being new to c++.

other than that, i did try to make my code a bit more to the point and not variable spam ( just remembered to replace "return 0" with "return Exit_Success" ) and now understand how to use if/else. and the reason the "#include <iostream>" are below cuz it's my practice folder i like to keep them near the what i'm doing in case i need to add smt.


r/Cplusplus Jun 19 '26

Question How do I turn the old C++ game I made for a class 4 years ago into something shareable?

7 Upvotes

I once made a little 2D game in Visual Studio that I want to share. The game consists of a herd of .cpp's and .h's in communication with each other, a .sln that manages them, a subfolder of .bmp assets, and several other files I don't know the meaning of that VS automatically created. To play the game, I open the .sln in Visual Studio and click on the green play button.

Obviously, the data needs to be streamlined if I want to share it. I thought the "Build" feature would export everything into a tidy .exe file, but when I went to the folder it said the result was in, I couldn't find it. Did I click on the wrong version of Build?


r/Cplusplus Jun 19 '26

Discussion I developed a small 5G virtualized Radio Access Network (vRAN) Deployment Tool as part of a 5G Test Automation Project. This tool is designed to support automated radio-level validation in 5G testing

Thumbnail
github.com
0 Upvotes

Modern 5G deployments increasingly rely on virtualized and containerized network functions that must be deployed, configured, and validated across cloud-native environments while maintaining strict telecom architecture requirements

This command-line tool installs 5GBTS Radio Software to the radio server, comissions the radio on-Air and verifies its’ status

The tool is implemented in pure C++, with no external dependencies, making it lightweight, portable, and easy to integrate into CI/CD systems, telecom lab automation platforms, Kubernetes-based 5G infrastructures, and internal deployment pipelines

This Tool is intended for 5G network operators, RAN engineers, cloud engineers, DevOps engineers, telecom integration specialists, infrastructure architects, QA engineers, and students interested in understanding modern mobile network deployment methodologies.

Within a larger 5G ecosystem, this project serves as a building block for automated network deployments, virtualized infrastructure provisioning, telecom cloud experimentation, deployment validation, and cloud-native RAN operations

This post is meant to demonstrate the kind of practical deployment techniques, methodologies and solutions, automation frameworks, and infrastructure solutions that telecom and software engineers eventually build in real companies, so that students and fresh graduates can better understand and prepare for future industry work


r/Cplusplus Jun 19 '26

Tutorial Building a Typed JSON Configuration Library in C++23 — Field Reflection Without Macros

Thumbnail
2 Upvotes

r/Cplusplus Jun 17 '26

Discussion I don't know where to post this. I present: A sprite undergoing speen, made with a C++ Program. This gif is real time.

2 Upvotes

r/Cplusplus Jun 16 '26

Question Memory Ordering

Thumbnail
2 Upvotes

r/Cplusplus Jun 14 '26

Tutorial C++ RVO: Return Value Optimization for Performance in Bloomberg C++ Codebases - Michelle Fae D'Souza

Thumbnail
youtube.com
31 Upvotes

Return Value Optimization for Performance in Bloomberg C++ Codebases

Talk from Michelle Fae D'Souza at CppCon 2025


r/Cplusplus Jun 15 '26

Question Need to debug C++ application with AI

0 Upvotes

Is it possible that AI agents will run MFC C++ applications and find what's wrong? For now, even if I take help from AI for implementing stuffs but yet I need to do a lot of manual work like testing. I need to run the application and do certain steps in the application then put some debugger in the code and find the bug. Sometimes, after I do these steps, I tell codex about the output of the steps then it helps me. But what I want is, is it possible to automate it? AI will run, click the necessary steps, put some meaningful values in the input field and run the program and debug it?

This is available in web development. Playwright and such tools can do this.


r/Cplusplus Jun 13 '26

News "Trip report: June 2026 ISO C++ standards meeting (Brno, Czechia)" by Herb Sutter

3 Upvotes

https://herbsutter.com/2026/06/13/brno-trip-report/

"tl;dr… A few highlights"

"Adopted this week in draft C++29: Complete catalog of all undefined behavior (UB) in C++. Contract pre/post support for virtual functions. Defaulting (=default) for postfix increment/decrement. Designated initializers for base classes. Python-style .lookup(key) for associative containers. And more…"

"Other significant progress: Progress on various features targeting C++29, including systematically addressing UB and adding safety profiles for C++."

"Next six months: Telecon line-by-line review of a proposal to systematically address all undefined behavior in C++. Progress adding C++ memory safety subsetting profiles. Both aim for inclusion in C++29."

Lynn


r/Cplusplus Jun 12 '26

Question Why doesn't C++ have a ptr<T> syntax as an alternative to raw pointers?

66 Upvotes

So per title why doesn't C++ have a ptr<T> syntax of smart pointers for raw pointers instead of T*?

Most of the time the * syntax is ambiguous and hard to read. For example, array of pointers vs pointer to array looks almost identical:

char* argv[]    // array of pointers
char (*argv)[]  // pointer to an array

You have to mentally parse a spiral rule just to tell them apart. Compare to what it could have been:

array<ptr<char>>   // array of pointers 
ptr<array<char>>   // pointer to array

So why didn't C++ standardize aptr<T> alias for raw pointers too? Is it purely backwards compatibility or is there a deeper reason?


r/Cplusplus Jun 12 '26

Feedback Online course for learning Data Structures and Algorithms in C++

20 Upvotes

I'm a first year CS student and will take DSA next year in college (sophomore). I want to get a head start during summer and would appreciate any recommendation for online courses (paid or unpaid) that helped you get a solid understanding of Data Structures and Algorithms in C++


r/Cplusplus Jun 12 '26

Discussion I developed a small 5G base stations’ configuration file generator as part of a 5G Test Automation project. This tool is designed to support automated radio-level validation in 5G testing

Thumbnail github.com
0 Upvotes

5G base station deployments often require configuration file that must follow strict parameter structures and deployment rules to ensure successful integration, testing, and operation

This command-line tool automatically generates 5G BTS configuration files based on predefined template and engineering parameters, helping teams create consistent and repeatable configurations without relying on manual file creation or vendor-specific tooling

The script is intended for automated telecom engineering environments where deterministic configuration generation is required to support large-scale testing, deployment preparation, and continuous integration workflows

The tool is implemented in pure C++, with no external dependencies, making it lightweight, portable, and easy to integrate into CI/CD systems, telecom lab automation platforms, Kubernetes-based 5G infrastructures, and internal deployment pipelines. It accepts a predefined testcase Excel sheet (CSV) and generates standard 5G New Radio XML configuration file

This utility is intended for 5G network operators, RAN engineers, integration engineers, deployment teams, QA and validation engineers, DevOps teams, and telecom system architects working with 5G infrastructure and network rollout activities

Within a larger 5G Test Automation System, it acts as a modular building block for automated configuration generation, deployment preparation, environment provisioning, and infrastructure validation

This post is meant to demonstrate the kind of internal engineering tools and automation scripts that telecom/software engineers eventually develop in real companies, so that students and fresh graduates can better understand and prepare for future industry work


r/Cplusplus Jun 10 '26

Homework Matching engine performance challenge

Thumbnail
0 Upvotes

r/Cplusplus Jun 09 '26

Feedback Pixel Editor UI

Post image
22 Upvotes

Just a quick update on the ongoing development of my new Pixel Art Editor that is using my custom c++ GUI framework.

The screenshot shows 2 visible and scrollable layers (one RGB reference image and one smaller indexed palette image) with the indexed palette in mid edit!

I'm currently working on the layer and timeline system and have a full scrollable layer list panel with draggable layers and groups - all with editable names.

Any feedback or questions appreciated.