Category "c++"

How to use c++20 modules with CMake?

Clang and MSVC already supports Modules TS from unfinished C++20 standard. Can I build my modules based project with CMake or other build system and how? I tri

How to define a non blocking input in C++

I'm making a multithread application in C++. In particular, a secondary thread is involved in input operations, the problem is that std::cin is a blocking instr

RocksDb: Multiple values per key (c++)

RocksDb: Multiple values per key (c++) what i am trying to do I am trying to adapt my simple blockchain implementation to save the blockchain to the hard drive

Breakpoints won't hit on CLion

CLion gives the following hover message accompanied with a "no" sign instead of a breakpoint red dot: This breakpoint will currently not hit. No executable cod

why the first example in xtensor can't run?

I install the xtensor by conda conda install -c conda-forge xtensor and I find the position where the xtensor is installed, path_xtensor="/amax/home/user/minic

Why qt project can throw errors like undefined reference to `__imp_ Py_Initialize' and so on?

I want to add python functions in C++ code. The project is written using qt. In I have: ... INCLUDEPATH += "D:/workplace/Python/include" LIBS += -L"D:/

I can't assign the value of a geometry point to a variable

I was trying to assign the value of a geometry point (it has x,y,z. All of them are float64. If you want to check it:

Compiler discrepencies in deduction of template parameter of nested alias template

Consider the following code snippet where we we're trying to deduce the template parameter to the function foobar(): struct Bar { static constexpr auto size =

Is placement new on a const variable with automatic storage duration legal? [duplicate]

Is the following code legal according to the standard? #include <new> int main() { const int x = 3; new ((void *)&x) int { 1

write all words from string containing substring C++

I need to print all words from the text file which includes substring, how can I add to the code? The code which I have is printed below #include <iostream&g

How to judge whether the incoming buffer is valid in C++?

In my function, a memory pointer and its size are passed as parameters: int myFun(uintptr_t* mem_ptr, int mem_size) { // Code here } Is there any way to te

Store an instance of a different classes in a map

I want to be able to store an instance of a different classes in a map so that I can add, delete and access the instances outside of the entity class. This is w

How to mix formatting in a single call using libfmt

I want to print the time center aligned. But I do not know how to mix arguments with fmt. std::cout << fmt::format("|{0: ^80}|\n", ""); std::cout <<

Overloading the pointer-to-member function operator. Attempting to resolving the const overloaded version isn't compiling

I'm currently doing practicing on the ->* operator with the intent to write a smart pointer. I've done the basics on how it works. For this example I want to

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