Category "c++"

Intel oneapi detect if I'm on FPGA

Is there any way to detect via CMake whether an FPGA accelerator is available or not ? I'd like to do something like if (FPGA_AVAILABLE or FPGA_EMULATOR_ON)

How can I encapsulate code dealing with matrices and make it reusable?

At my course we are getting tasks that always start with filling a random matrix size nxm with random numbers. I want to create(a library?, a class?) some struc

'undefined reference to' when using GTK with CMake

I'm trying to build basic GTK+ code(one of its tutorials) with CMake, but I keep getting 'undefined reference to *' where * is any GTK function that is in the c

Library not loaded SDL2 using Xcode Version 13.3.1 on macOS 12.3.1

Am trying to learn SDL2 using Xcode Version 13.3.1 on macOS Monterey 12.3.1 Followed these steps: Downloaded/ran the dmg file and moved the extracted SDL2.frame

Error: Undefined reference to mysql_init and mysql_real_connect

good I am developing a C ++ program using CodeBlocks that connects to a MySQL database with XAMPP using the libmysql.a linker but I can't get it to work, this i

X11 Copy is returning only returning GDK_SELECTION, for CLIPBOARD Selection

I am writing a component which has to monitor changes in CLIPBOARD for a X11 window. auto display = XOpenDisplay(NULL); auto screen = DefaultScreen(mdisplay); a

ImGuiConfigFlags_DockingEnable not found

I'm trying to implement ImGui in my opengl app, but, for some reasons, the flag: ImGuiConfigFlags_DockingEnable is not found. I even tried to go in the files an

how to change access time of a file using utime and mktime syscalls and c++?

I was trying to change the access time of a file, but i didn't get the result i wanted. this is what i tried: struct tm time; time.tm_sec=56; time.tm_mi

VS profiler, source information not available

I'm trying to use visual studio performance profiler for the first time and I'm interested in a specific function of mine which is successfully detected by the

Why does std::getline() skip input after a formatted extraction?

I have the following piece of code that prompts the user for their cat's age and name: #include <iostream> #include <string> int main() { int a

Invalid conversion from char * to int fpermissive

#include<iostream> #include<vector> using namespace std; int main(int argc,char** argv){ int n; if(argc>1) n=argv[0]; int* stuff=new int[n];

My pointer does not point on the same value when its call in a slot QT C++

I do a pokemon project with a Qt interface. I created a class Trainer and Pokemon : class Pokemon { protected: string itsName; doub

How does object initialization ambiguity get resolved?

The class has two constructors, one that has no initialization value and does not increase the 'val', the other takes a reference to an object, and increases 'v

Error while executing a c++ umat in Abaqus

This is a simple Linear elastic umat written in c++.When i try to run a abaqus job for a simple model using the below code, Abaqus give me the following error

Generating compile time functions string for formatting strings with libfmt

I want to create a nice table in stdout. The table has a lot of headers that are mainly compiletime strings. For example: std::cout << fmt::format("|{0:-^

AddressSanitizer:DEADLYSIGNAL error when trying to run code using stack for valid parenthesis problem set

I was trying this problem called valid parenthesis on leetcode.com when an error popped up saying this: AddressSanitizer:DEADLYSIGNAL ==========================

Can we unit test memory allocation?

I have to test a library that provides its own memory allocation routine: void* allocation_routine(size_t size) throw(); Documentation states that this funct

QPolarChart hide radial tick labels

I have created a QPolarChart and I want to hide the radial tick labels but leave the tick circles. I simply want to get rid of the text which shows "0.0", "20.0

Setting age in Parellelised game of life

I am a university student and my teacher is making us to create a prey/predator simulation with OMP for. I had covid during his lectures and he didn’t upl

Convert between std::u8string and std::string

C++20 added char8_t and std::u8string for UTF-8. However, there is no UTF-8 version of std::cout and OS APIs mostly expect char and execution character set. So