Questions tagged [c]

C is a general-purpose programming language

Filter by
Sorted by
Tagged with
2
votes
0answers
13 views

After compiling and installing SDL, something happened to OpenGL and Vulkan

I tried to compile and install SDL2 from https://wiki.libsdl.org/Installation. Then I tried to test a program, I got a program file missing error for libsdl2-2.0.so.0: Program file cannot be opened. ...
0
votes
0answers
15 views

Highlight TODO and other keywords in the Text Editor (gedit) isn't working

I'm using the Text Editor (gedit) for couple months. I have downloaded the inkpot theme because it seems good. https://gist.github.com/carmelom/14e74271d4c03f3028f0e050be0e7f0a The problem is, it's ...
-3
votes
0answers
43 views

how to get cpu usage with percentage % in c program

i try to get a cpu usage with c programe but the result does not come out in percentage %, what wrong with this code? maybe someone can clarify or offer me another way to recover the cpu used i have ...
0
votes
0answers
25 views

Alternative for mouseclick function in Linux?

So i got some problem with my window and i decide move to linux. I'm working with some c++ code that required windows.h, so i decide to change some of my code, so it can run in linux. one of my code ...
0
votes
0answers
25 views

compilling with gcc and g++: vp8_multi_resolution_encoder - compiling with gcc showing so many error but g++ showing only one

First of all, i have built libvpx for x86_64-linux-gcc. then Trying to use examples/vp8_multi_resolution_encoder.c. I need to convert a a video file into multiple resolution using vp8 encoder. I have ...
0
votes
0answers
25 views

No providers match the current filters

I have an error st-device-monitor-1.0 "v4l2src device=/dev/video0 ! image/jpeg, width=(int)1280, height=(int)720, framerate=30/1 ! jpegdec ! videoconvert ! appsink" the error is: failed to ...
1
vote
1answer
34 views

#include <sqlite3.h> Not working with GCC - C programming

I have just started with C programming and am originally a python programmer so please try and not use very advanced words I wont understand much. So when I try using gcc as my compiler as I get an ...
1
vote
1answer
72 views

How can I solve this erorr “/usr/bin/ld: cannot find -libpthreads collect2: error: ld returned 1 exit status” if i already install pthread library?

**I write this c code and I already install a pthread library writting this command **sudo apt-get install lpthread-stubs0-dev #include <stdlib.h> #include <pthread.h> #include <stdio.h&...
0
votes
1answer
35 views

Any Windows Manager Controler libraries for Python/C/C++?

I was wondering if there are any libraries for Python, C or C++ that help you interface with your window manager/x-windows? I am currently using os.subprocess and feeding it wmctrl bash commands and ...
0
votes
0answers
27 views

Does fgets hold somehow where it stopped reading the FILE *stream?

I am trying to get a sample program on how to write to a file: #include <unistd.h> #include <stdio.h> #include <string.h> int main(int argc, char **argv){ char buff[1024]; size_t ...
0
votes
0answers
15 views

Signal when PulseAudio load/unload modules

There is a way to know if PulseAudio has loaded/unloaded a module? Like a signal from PulseAudio? I know how to query for modules: pactl list sinks but I need some sort of IPC signal mechanism from ...
0
votes
0answers
17 views

How to Run SystemC on Eclipse

I recently install Eclipse from USC. I am using Ubuntu-18LTS. I have installed systemc-2.3.3. But I am stuck at running systemc program in eclipse. Could anybody please give steps for running systemc ...
0
votes
0answers
170 views

error: ‘Default’ is not a member of ‘ns3::YansWifiPhyHelper’

I want to compile file "third.cc" on ns3.33 simulator and I have that error: error: ‘Default’ is not a member of ‘ns3::YansWifiPhyHelper’ 108 | YansWifiPhyHelper phy = YansWifiPhyHelper::...
0
votes
0answers
32 views

configure: error: Cannot enable MemorySanitizer ubuntu18.04

make powerdns in ubuntu18.04 server by this option ./configure --enable-msan and I install 100+ packages but it could resolve error checking whether to enable MemorySanitizer... yes checking whether ...
0
votes
0answers
35 views

How to open terminal through c program and run another code on it same time

i want to open a new terminal and run on it an executable (.exe) using a C file , but my problem is that i don't want to terminate the process that is going to run the (.exe), i tried this command : &...
1
vote
0answers
33 views

Inotify cannot detect valid path [duplicate]

I m using inotify to get events of file changes in directory. int fd = inotify_init(); for(const fs::path& p : fs::recursive_directory_iterator(filename)){ if(fs::is_directory(p)) { ...
0
votes
1answer
70 views

how can I read from a USB device without knowing the device name?

I have an Arturia, MiniLab, it is a serial, non block device. I would like to read keypresses from the device, but I cant figure out where the /dev/device is that I should read key presses from. I ...
0
votes
0answers
27 views

Is there an way to rotate a specific window from terminal?

I am using cava music player.So since cava by default appears horizontally , i wanted to change the orientation how cava appears to vertical or tilt the window so that it appears vertical.Is there any ...
0
votes
0answers
43 views

How to get the build version in C

I'm working on a function in C which allow me to save in a variable in the OS build version. I have done it already on MS-Windows and macOS; However, I can not find any information for Linux(Ubuntu) ...
0
votes
0answers
95 views

C++ Api to disable keyboard and mouse inut

I need an C++ API for Linux to disable keyboard and mouse input, and enable it once ctrl + alt + del is pressed( The shortcuts are not important). In Windows there is alternative BlockInput function ...
0
votes
0answers
26 views

Shipping SDL2 C Project in Ubuntu

everyone! I have created a SDL2 project in Ubuntu using C and the terminal as compiler. I want to ship the project in order to send it to my friends. Does anybody know how to achieve that without ...
0
votes
1answer
741 views

Simple C hello world program is not working in Visual Studio Code [closed]

I am fairly new to C coding and cannot get a simple C hello world code to work with Visual Studio Code. The code looks like this: #include <stdio.h> int main() { // printf() displays the ...
0
votes
1answer
28 views

Editing wc -l src Output

I am new to the Topic and working on a few bash commands. I am stuck at a task where i Need t ouput my result in a specific Format. wc -l folder/* The Output gives me: 0 folder/file1 3 folder/file2 3 ...
0
votes
0answers
20 views

Long doubles acting more like doubles than real long doubles

I am using Ubuntu 20.04 inside Oracle VM VirtualBox installed on a Windows 10 machine. Long double seem to act like normal doubles. I'm not sure if it's a conversion issue or a storage issue Likewise, ...
0
votes
1answer
204 views

Can we use graphics.h library for C/C++ on ubuntu 20.04?

For a few days now, I have trying to install the graphics.h library in 20.04 and failed and then tried on 18.04 and it worked and I can use it, but I really want to know if one could use graphics.h ...
0
votes
1answer
494 views

what is the difference between gdb and gdb-peda?

I have tried to search on google but still could not find anything that i understand. Can anyone tell me the difference between them? And which one is better to debug c++?
3
votes
2answers
1k views

How do I install gcc 4.8 in Ubuntu 18.04?

I am currently using Ubuntu 18.04, and I need gcc 4.8 for MATLAB. So I tried to install gcc-4.8 using $ sudo apt-get install gcc-4.8 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/...
-1
votes
3answers
115 views

Why does Ubuntu use Python despite the fact that Python is an interpreted language? [closed]

Interpreted languages like Python are generally slower than compared to C/C++ or Java. Are there any scientific reasons for Ubuntu to opt Python instead of other programming languages like C/C++ or ...
1
vote
1answer
700 views

sleep() function in C doesn't work on Ubuntu 20.04 (WSL). Is there any way to make the sleep() work?

I am using a Windows app for Ubuntu to practice C/C++ code. Eventually I found that sleep() call does not work here. I went through the answers provided earlier on other posts but could not find any ...
0
votes
0answers
204 views

How can I install GLUT with GCC?

I know similar questions exist, but I have pretty much looked at all of them and I couldn't find an answer that worked. Here are the commands I have tried so far. sudo apt-get install freeglut3 sudo ...
2
votes
3answers
2k views

Permission denied on shared memory segments in /dev/shm/

in Ubuntu 20.04 I'm having problem with accessing shared memory segments by different users. The associated files are created using shm_open() with the combination of O_CREAT and O_RDWR flags and ...
0
votes
0answers
110 views

Where can I find the source code of command line programs and how should I implement custom ones? [duplicate]

Every distribution of Linux has its own set of built-in command line programs. For example: cat, grep etc. Now, my question is: How are these built-in programs implemented and where can I find the ...
1
vote
0answers
753 views

How to install gstreamer 1.16 on ubuntu, which already have gstreamer 1.14

Is there ant way I can upgrade to gstreamer 1.16 from 1.14 or The way I know is: download .deb file and dpkg --install .deb But doing this have other dependency...like libc6 need to >=2.29 . . Any ...
0
votes
0answers
26 views

Failed to write file in C shared library

I'm trying to modify the encryption function on libsrtp which is used by the Asterisk server. Now, I am testing the implementation of the decryption method on the Asterisk server. I try to do it by ...
0
votes
0answers
381 views

Basic Gstreamer pipeline “ gst-launch-1.0 audiotestsrc ! audioconvert ! autoaudiosink ” not working, error

:~# gst-launch-1.0 audiotestsrc ! audioconvert ! autoaudiosink Setting pipeline to PAUSED ... shared memfd open() failed: Function not implemented shared memfd open() failed: Function not implemented ...
2
votes
1answer
39 views

memory allocation different when lookup in system monitor

I write a c program to allocate specific size of memory and free them. Defaultly, it create totally 100MB memory by malloc 1MB for each entry of a 100 size array. When I lookup system monitor and find ...
0
votes
0answers
43 views

Unable to get input via Gedit embeded terminal

I have written the below bash script to compile and run my C programs, and added it to the 'Manage External Tools' list. #! /bin/bash cd /home/prm/Documents/Anubhav/C FILE="$(ls -Art | tail -n 1)&...
1
vote
1answer
586 views

Installing allegro 4.4 on ubuntu 19.10

I downloaded the repository of allegro 4.4 from here, but i have no idea how to install it on ubuntu. I looked for tutorials, but i didn't find them. Could you tell me how to install it please? Maybe ...
1
vote
0answers
148 views

Ubuntu 18.04-Runtime error- Embedding python to C

I am working on a project which is related to object detection and ocr. I am using Ubuntu 18.04 and python 2.7, yolov3 for object detection and tesseract 5.0.0-alpha-692-g62ea for ocr. I have to embed ...
1
vote
1answer
79 views

Unable to run program on Linux target

I am working on Ubuntu 20.04. I made a simple program (Hello World), and a makefile for it on my laptop and run it (./Simple), and everything worked. Then I included the program (Simple.c) in the ...
-1
votes
1answer
125 views

trying to install GCC [duplicate]

I would like to install gcc compiler by this command apt install build-essential and after pressing Yes, it asks me to insert some media. Media change: please insert the disc labeled 'Ubuntu 18.04....
0
votes
0answers
219 views

Mimic deluser command in linux

To delete a user without deluser in linux we have to do these things Remove user from etc/passwd Remove user from etc/shadow Remove user's directory from /home/ (I used sudo rm -rf /home/username) I ...
0
votes
2answers
73 views

Passing control characters to c program

i'm trying to pass my string with special characters, but somehow my program recognize them too literally. Here is my program. int main(int argc, char *argv[]) { char *str; char *trim; ...
-2
votes
1answer
410 views

shell unnanme -r command not found

shantanu@LAPTOP-3NM82R8U:~/c$ make make: unname-r: Command not found make -C/lib/modules//build M=/home/shantanu/cmodules make[1]: *** /lib/modules//build: No such file or directory. Stop. Makefile:3:...
1
vote
0answers
79 views

How to get 256 colors working in ncurses program

I am trying to run Listing 3-5 in the book Programmer’s Guide to NCurses by Dan Gookin (page 41). #include <ncurses.h> #define NEW_COLOR 1 #define RED 0 #define GREEN 750 #define BLUE 750 int ...
0
votes
1answer
990 views

Error missing binary operator while preprocessor compiling C program

I tried upgrade to Ubuntu 18.04 and compile a simple C program from the terminal with gcc -o test test.c. #include <stdio.h> void main() { printf("h\n"); } but it threw a missing binary ...
0
votes
0answers
1k views

error: C compiler cannot create executables

I am trying to install netcdf in order to compiling WRF. However, it shows an error which I do not understand. and config.log: This file contains any messages produced by compilers while running ...
0
votes
1answer
56 views

What is the difference between giving input by typing from keyboard and by redirecting? [closed]

I've got a short, easy to understand piece of code: #include <stdio.h> #include <unistd.h> int main(){ char buff[0x10]; read(STDIN_FILENO, buff, 0x10); int result = write(...
1
vote
1answer
537 views

Playing an audio with cron jobs

I am trying to add a new command to my own shell such as: alarm 7.15 music.wav I want to create a cron job so it can schedule alarm daily at given time. So, I create a file for each call of alarm, ...
-1
votes
2answers
741 views

(First C Program / Hello World) Keep getting Syntax Error [duplicate]

This is my C code: #include <stdio.h> void print_hello() { printf("Hello n10321234, welcome to BSB211"); } int main() { print_hello(); return 0; } However, I keep getting the ...

1
2 3 4 5
9