Skip to content
Advertisement

Tag: c++

fork() giving wrong output in linux (reverse output)

I have written code in C as follows Output as shown in ubuntu 20 OS I am expecting that child process should be written first as after fork() is called child process’s printf() will be printed on screen and after that parent’s printf() will be printed but reverse is printed actually. Please help me why child process’s printf() is not

Trying to create map with char array field invalid field error

I like to know how to create ebpf map with char array value I tried like this and this is full code for the ebpf program and this is my user function I assigned to perf_buffer_opts and this is the full code. so can anyone please tell what I am doing wrong why is saying invalid argument full userspace code

CMake C++ Project librealsense: undefined reference to OpenGL with CLion

I am trying to integrate librealsense C++ CLion Project on Ubuntu 20.04. Compiling the Librealsense separately in the terminal works just as expected. the Project looks like this: RS_Pipeline . ├── build ├── main.cpp ├── CMakeLists.txt └── librealsense // the integrated lib ├── CMakeLists.txt ├── third-party // libs like GLFW and GLAD which are use in the examples ├── examples

Environment variable error while trying to create a solver in OpenFOAM 9

I’m trying to create a solver in my /opt/OpenFOAM/OpenFOAM-9/applications/solvers/electromagnetics directory using sudo foamNewSource App newSolver. But, I keep getting the following error: And then, although I can see a newSolver.C file, I cannot see a Make directory and neither the rest of the files. I’m running EndeavourOS Linux x86_64 with kernel 5.15.6-arch2-1 and shell bash 5.1.12. I installed the openfoam-org

getifaddrs returning ‘bad file descriptor’/crashing the application

In my program, I have a thread which has to continuously monitor the network interfaces therefore it continuosly uses getifaddrs() in a while loop. Most of the time my program works fine. However, sometimes getifaddrs() returns -1 and errNo = EBADF(bad file descriptor). In order to not exit my thread, I have temporarily replaced exit with continue(as I don’t want

Get user’s group from linux kernel driver

I’m developing a simple pipe kernel driver as an excercise for university, and my task states that users from each user group should have access to their own separate pipe. But I can’t find how to get group of the user who opened my driver file. I have functon static int pipe_open(struct inode *i, struct file *f) which receives arguments

Can’t launch debug – C in VS code on Linux

Let me preface this, I am very new to linux and to working on a non-IDE based setup. I am trying to debug a very simple C program using vs code version 1.55 I unloaded all modules beforehand, so vs code can load appropriate default gcc & gdb versions (which it did, GCC 8.2) I am following the VS code

How to cross-compile Qt6 on Linux for Windows?

I’m trying to cross-compile Qt 6.2.1. Target – Windows, my machine OS – Linux (Mint 20.2) (both 64bit). Unfortunately I can’t compile it on Windows, so I have to do this cross-compilation. My configure cmd: At the end of CMake work I’m getting this: And then, after cmake –build . –parallel: I have checked (this is also visible in log

Find CFLAGS and LDFLAGS equivalent in linux

I’m trying to figure out what is the equivalent paths of these in Linux. I downloaded the openssl package sudo apt-get install libssl-dev Answer Assuming you want to find flags needed to build using that installed package, then pkg-config: So you don’t need any special -I nor -L flags, because the includes and libraries are already in the system paths,

Advertisement