Skip to content
Advertisement

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 almost no execution time. The program just has to schedule

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 the command you write this option; the linker searches and processes libraries and object files in

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 downloaded libdvbv5 source again and rebuilt it. All seemed

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 code: The value of top

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 have its special syscall for fork. So I now wonder: why does glibc implement fork() in terms of clone, if the kernel already provides

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 can I achieve

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 grouped under one

Advertisement