Questions tagged [c]
C is a general-purpose programming language
487
questions
0
votes
1
answer
13k
views
File doesn't open using fopen() function in C [closed]
I'm using Ubuntu 18.04 on VMWare Fusion.
I have no idea why the file doesn't open using fopen() function in C.
The code is below.
#include <stdio.h>
#include <stdlib.h>
#include <errno....
1
vote
1
answer
4k
views
sublime text does not open
I've installed sublime text 3 using the instructions from this question, but after doing subl it doesn't open anything.... I am trying to open C files.
It doesn't do anything:
1
vote
1
answer
4k
views
Perf linux tool : Function name not shown in the symbol column [closed]
I am not sure if this is the right forum.
I am trying to benchmark a simple compiled c code but i cannot see it's main and child functions in the perf report. All i see are system functions and hex ...
2
votes
1
answer
2k
views
PHP exec() has write permission error despite write privilege
I am running 7.0.28-0ubuntu0.16.04.1, under LAMP, on two Ubuntu 16.04. The C code, to open the file for writing is:
#define ERROR_OPENING_FILE -4
fprintf(stderr, "Open output file: /var/www/...
2
votes
1
answer
2k
views
How to compile C program file in Ubuntu 18.04
I can't compile a C file in Ubuntu 18.04.
In terminal I used this command:
$ gcc -o abc.o abc.c -lm, but it says that gcc is not found.
This exact command can compile a C program in Ubuntu 16.04 (...
1
vote
0
answers
720
views
Undefined symbol error
I'm working on a base project by someone else and I'm kind of new to the Linux system.
I know how to use sqlite3 in Windows' Visual Studio, however in Linux it's not working.
I've come to the ...
15
votes
2
answers
4k
views
Can I act on the event that a window opens without polling?
I am trying to find a way to detect the event of a window (any window) being opened in Ubuntu 16.04
I would like to be able to detect the "window open" event and check if the opened window was my ...
2
votes
1
answer
371
views
Can't compile Ardour: "Can't find -lfftw3f_threads"
I am trying to install Ardour from source. I successfully completed the configuration process after a few failed attempts and installing the required libraries. Now the installation process cancels ...
4
votes
1
answer
8k
views
How do I print backslash followed by newline with printf?
Using Python, I get
$ python3 -c 'print("\\\n")'
\
$
That is, one backslash and one newline, followed by an extra newline inserted by the interpreter.
Using C, compiling the code
#include <...
1
vote
0
answers
189
views
Question regarding rtl_fm and specific USB port connections
I am planning to use 2 RTL-SDR dongles on a single computer. The thing is, they will be operating on 2 different frequencies, and so different antennas will be used.
I would like one instance of ...
7
votes
2
answers
12k
views
Can't run my hello world in C
I'm trying to write a basic program in C using gedit or sublime text (which I prefer), but no matter what I do when I try to compile or run, or even while writing, I have no option to use 'stdio.h' or ...
0
votes
0
answers
320
views
gcc doesn't compile C How To Program 'create a random access file' tutorial
The tutorial on File Processing in C How To Program 6th Edition (Chapter 11
Fig. 11.11) creates a random access file sequentially. fwrite and fread are used in the code to create 100 blank records ...
1
vote
2
answers
21k
views
system("pause") for linux in gcc C
What is the system("pause") equivalent in Linux on C language. not C++.
I want to use that for my c program. Theres a logout function. But before it returns to the main login function i want to give ...
2
votes
2
answers
2k
views
GCC -std=gnu99 error
I'm trying to compile a C code with this command gcc -Wall -m32 -std=gnu99 -o <filename> <filename>
Instead of getting an output file, I get this.
/usr/bin/ld: cannot find Scrt1.o: No ...
3
votes
2
answers
1k
views
C Library Function Actual Implementation
I was wondering where I can find the actual C implementation of atoi() (or other such functions). I looked into stdlib.h but it seems like atoi is not implemented there. Is there a way to view the ...
10
votes
4
answers
32k
views
C/C++ option not available in NetBeans
I upgraded Ubuntu 14.02 to Ubuntu 16.04 and realized that NetBeans was no longer working after the upgrade. So I installed netbeans again from the command line:
sudo apt install netbeans
But after ...
3
votes
1
answer
6k
views
Crontab and C program that should be executed into a terminal window
I want to create Cron job to run a compiled .c file. Let's say I have a file, called program.c, on my desktop. I compile it using gcc program.c,
which creates a.out executable file.
I want to open a ...
4
votes
3
answers
6k
views
Compiling C codes in Ubuntu
I'm a rookie programmer and trying to compile a C code in Ubuntu. I already installed GCC. How do I proceed from here?
1
vote
2
answers
3k
views
Undefined references to powl and log10 even though -lm is used (Trusty via Travis)
When compiling C files with cc -lm -std=c99 ... in Trusty, I get the following error:
fraction_math.c:(.text+0x5cb): undefined reference to `powl'
/tmp//fetlang_build//fet_obj_debug//core/chain.c....
1
vote
0
answers
1k
views
sprof fails to generate flat profiling for my shared library: Inconsistency detected by ld.so
I am unable to generate flat profiling result using sprof in Ubuntu 16.04.02 (as well as 14.04.01). Here is a reproducible example, adapted from man sprof.
First create a directory for experiment, ...
0
votes
0
answers
168
views
Installation from a .c file
I am trying to install a program that is installed from a single ANSI-C-file. However, the instructions that they give in the manual don't seem to work on Ubuntu. The manual reads:
The source solvate....
3
votes
2
answers
10k
views
How to compile C GTK3+ program in Ubuntu for windows?
I am using and gcc-7 and mingw-w64.I want to compile a c gtk3+ program in Linux using mingw so that it will produce .exe file which can be run in windows.I am able to Compile normal c programs using ...
-2
votes
1
answer
287
views
How can I install BCL (basic compression library)?
I want to install bcl (basic compression library)
I need to copy a file into the C compiler’s (gcc)
lib directory, and copy a header file into the compiler’s (gcc) include directory.
I want to know ...
5
votes
1
answer
18k
views
How to install latest GTK for creating C programs
I want to install latest version GTK to make small c programs. I've just finished "let us c" book which is very basic.Now I want to make GUI programs.while compiling the c program I got the following ...
1
vote
1
answer
1k
views
How to install PAPI on Ubuntu 16.04 and access performace monitoring counters?
I need to count L2 cache misses (my cpu is i5-3550), so I downloaded last PAPI version. I followed instructions contained in the archive to install it (./configure, make and make install) and it ...
4
votes
4
answers
6k
views
How do I know what programming languages are pre-installed in Ubuntu?
How do I know what programming languages (I mean their compilers and interpreters) are already pre-installed in Ubuntu? For example, I see that Python is here. If I type python command in the terminal,...
-5
votes
1
answer
5k
views
How do I run clang after installing it? [closed]
I have downloaded clang. When I got onto terminal and type clang it results in the error no input files.
2
votes
1
answer
5k
views
Do we have to write our own arpa/inet.h? [closed]
#include <stdio.h> /* standard C i/o facilities */
#include <stdlib.h> /* needed for atoi() */
#include <unistd.h> /* defines STDIN_FILENO, system calls,etc */
#include &...
2
votes
0
answers
59
views
Lean C development environment on Ubuntu 14.04 [duplicate]
I need a very lean system with minimum of packages installed for development in C programming language.
I know about build-essential meta-package but it's too big for my intents as I'm just working ...
0
votes
1
answer
1k
views
Gnome Builder Run Error
Hello community I'm the newbiest Ubuntu user ever. I'm also Computer Science student migrating to this operation system and looking for clean IDE to build my algorithms. I found one called "Builder" ...
0
votes
0
answers
4k
views
Fix Compilation Error: stray \200 , stray \213 and stray \342?
Here is a simple code that adds two numbers in each thread and then gives total balance in the end:
#include <pthread.h>
#include <stdio.h>
int currentBalance=100,newBalance=0,oldBalance=...
2
votes
3
answers
54k
views
What is "sh: 1: pause: not found"?
I am learning C as first programming language. I have typed following source code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,s,d;
printf("type the number which ...
3
votes
1
answer
10k
views
cross compilation for ARM: error no such file or directory
I have written simple Hello world program and compiled it with gcc-arm-linux-gnueabi compiler. It compiles well but when i try to execute it on ARM machine it complains "no such file or directory".
I ...
1
vote
2
answers
1k
views
What will happen if i type ctrl - c on the terminal [closed]
I got this program my friend sent me. And were both new at ubuntu and she asked me what will happen if we enter ctrl-c on the terminal
#include <signal.h>
#include <stdio.h>
void catch(...
0
votes
1
answer
1k
views
Making simple graphical programs without an X Server (alternatives to svgalib)
Is it possible to create simple graphical programs in C without an X Server. I'm talking about svgalib or libsvga. Is there another alternative library? But I can't get it on 16.04 LTS.
I do wish to ...
1
vote
2
answers
12k
views
Error: /tmp/ccOB6cIT.o: In function `main': example.c:(.text+0x4a) [closed]
I picked up the following code from a practice file
#include <stdio.h>
#include <pthread.h>
void *kidfunc(void *p)
{
printf ("Kid ID is ---> %d\n", getpid( ));
}
int main(int count, ...
0
votes
1
answer
1k
views
How can I run c files in sublime text 3 that takes user inputs? [closed]
I am using sublime text 3 for my coding work, but I am not able to build C files and take the user input in sublime text 3.So please help me.
2
votes
1
answer
3k
views
Error when trying to install GPGME
I'm trying to follow this descrption for installing GnuPG interface on Ubuntu. The output of ./configure is
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build ...
0
votes
1
answer
1k
views
-SUID- Can't run a “-rwsr-xr-x” file as root
I am using Ubuntu 16.10. I just asked this question over at Stack Overflow but I was advised to ask at this forum.
I was following along a book, doing something like this:
#include <stdio.h>
...
2
votes
1
answer
290
views
How to send a byte as mutiple input to a file in Ubuntu [closed]
I have a file.c:
#include <stdio.h>
void main(){
char a,b;
printf("Input your character: \n");
scanf("%c",&a);
printf("Input your second character: \n");
...
0
votes
0
answers
1k
views
How to run c programm via sh script
I want to run two c programs in the home directory, but the programs are stored in another directories, where each has own directory. So, I do followings:
I have two scripts for each program in their ...
1
vote
1
answer
3k
views
no manual entry for string.h
I am trying to find a manual entry for "string.h", I have GNU gcc installed. But when I input man string.h, it shows me no manual entry for string.h, I am not sure what went wrong? Can anyone help me ...
2
votes
2
answers
2k
views
How to send commands to terminal and receive data from it?
Linux, Qt Creator. I ran this in a debugger:
#include <stdio.h>
char p[1000];
int main()
{
scanf("%s",p);
return 0;
}
It works. However, no terminal appears when I double click the ...
5
votes
1
answer
6k
views
Using cpplint on Ubuntu 12.04 LTS 32 bit
I want to use cpplint for C style checking. How do I do it on an Ubuntu 12.04 LTS 32-bit machine?
0
votes
1
answer
1k
views
How to Fix Vi Editor?
A couple of days back, I was trying undergoing a tutorial from KernelNewbies and as it asked, I did made some changes to vi editor. But, it seems that I have messed up something. I am unable to find ...
0
votes
2
answers
17k
views
Permission denied while running c file
ans@ans-HP-Compaq-6910p-GY837US-ABA:/media/study/coursera/IOT/Course2$ ls
hello.c~ helo.c helo.c~
ans@ans-HP-Compaq-6910p-GY837US-ABA:/media/study/coursera/IOT/Course2$ gcc helo.c -o hello
ans@ans-...
1
vote
1
answer
5k
views
execl() arguments [closed]
How can I use execl() function with arguments which are entered by an user in C?
I can do it with execv(args[0],args). How can I convert execv() to execl() ?
thanks.
0
votes
1
answer
2k
views
IPV6 Binding Failure Error: Cannot assign requested address [closed]
I have configured Ubuntu Linux system with the following interfaces & assigned IPV6 addresses as follows:
**Eth0:** Link encap:Ethernet HWaddr 00:50:56:8d:57:64
inet addr:192.168.254.10 ...
0
votes
1
answer
2k
views
Can't use cat to copy from file to another file using execlp in C [closed]
I'm using Ubuntu 16.10. I want to copy contents of a file to another file using execlp. I have two files named file1 (with content) and file2 (empty). If I give the following command on terminal
...
1
vote
0
answers
235
views
Problems Installing IUP CHICKEN Extension
I tried to compile a scheme file with CHICKEN and it says there that I need to install the iup port of CHICKEN. So I went to the website and tried to install the iup port but I got an error. Then I ...