I’m doing some first steps with threads on Linux systems, and i have this error which occures on the base of a program that gets some n argument and creates n number of threads. Here is the important part of the code: The function the threads should run: Important part of code in the main function Notic…
Tag: c++
Measuring execution time with clock in sec in C not working
I’m trying to measure execution time in C using clock() under linux using the following: The output is: The documentation says to divide the clock time by CLOCKS_PER_SEC to get the execution time in sec, but this seems pretty incorrect for a 2sec sleep. What’s the problem? Answer Sleeping takes al…
Undefined reference to `getaddrinfo_a’
I get linker error while compiling a minimal program that uses getaddrinfo_a on Linux. The program in question Compiler output: Answer You are using command in wrong way. Use -lanl should come after not before file name. https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html -l It makes a difference where in t…
Linux – cannot find shared library
Using Code::Blocks (13.12) / g++ to create some test code using the DVB V5 libraries on Ubuntu 14.04. The library was downloaded, built and installed following instructions in the download. Had it all working then had a disk crash. Decided to reinstall everything from scratch rather than use a backup, and dow…
Pop function for stack has unexpected behaviour [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question I was just taking lecture on behalf of my Guide and one student given this…
Why is sys_fork not used by glibc’s implementation of fork?
In eglibc’s nptl/sysdeps/unix/sysv/linux/i386/fork.c there’s a definition: which is used in actual __libc_fork() as the heart of the implementation. But e.g. in Linux’s arch/x86/entry/syscalls/syscall_32.tbl exists a sys_fork entry, as well as in syscalls_64.tbl. So apparently Linux does hav…
Setup makefile for ‘path agnostic’ inclusions
In my project files I just want to be able to say: main.cpp: When these headers files reside in separate I’ve setup my make file to attempt to achieve this but I still get fatal error: foo.h: No such file or directory so I haven’t been able to set it up correctly. Makefile: Is LIBS correct? How ca…
The first character in the output stream is replaced with the last character of that stream which is removed. Why is that so?
Program’s Aim: The program is a hangman game which get a list of planets from our solar system, saves it to an array then randomly selects one word from the array and subsequently prints two letters of the word on the board. The program runs perfectly in a windows environment, but fails in runtime on li…
Child forms groups on taskbar
I got an application, which has a main window, and then it open new forms. Whole application is like a document reader with many types of sub-forms. For example, I have Main window opened, 3 documet detail forms and 4 editors of other content. Now. As all sub-forms are childrens of the main form, they are all…
Linux DMA: Using the DMAengine for scatter-gather transactions
I try to use the DMAengine API from a custom kernel driver to perform a scatter-gather operation. I have a contiguous memory region as source and I want to copy its data in several distributed buffers through a scatterlist structure. The DMA controller is the PL330 one that supports the DMAengine API (see PL3…