Hot answers tagged

77

If you are on an amd64 installation, you can try to install the package libc6-dev-i386. This helped me solve the same issue you encountered while trying to compile smm from i8kutils.


50

apt-get install libcurl4-gnutls-dev or apt-get install libcurl4-openssl-dev depending on whether you want to use gnutls or openssl for SSL.


33

You can install libncurses5-dev package via Software Center or: sudo apt-get install libncurses5-dev Also, you can install the package by clicking here. When you need a file or package and can't find it you can use some tools. 1. apt-file First, install apt-file and update it. sudo apt-get install apt-file apt-file update You can search with ...


32

I got essentially the same message (except that ld-linux-x86-64.so.2 was replaced by ld-linux.so.2). I had installed Valgrind using apt-get so libc6-dbg was already included as a dependency. I haven't fully resolved this yet, but a clue is that the error correlates with my use of -m32 when building. So it would seem that, in my case, the problem is the ...


23

Since you're running an executable in the current working directory, you should prefix it with ./. So for your program run it as ./a.out. Explanation The terminal searches for executables in $PATH. This is a Unix environment variable that lists directories containing system binaries (such as ls, echo, or gcc). If you call an executable that's not in a ...


20

Run sudo apt-get install build-essential to install the C compiler.


18

Yes. The kernel will release all the resources allocated by a program upon the program's termination. This is done after the do_exit() function defined in kernel/exit.c has terminated its execution; the do_exit() function execution itself might be triggered by a number of events, most commonly by an explicit exit() syscall called by the program during its ...


18

Tl;dr You can generally "trigger EOF" in a program running in a terminal with a CTRL+D keystroke right after the last input flush. What does EOF mean? How can I trigger it? EOF means End-Of-File. "Triggering EOF" in this case roughly means "making the program aware that no more input will be sent". In this case, since getchar() will return a ...


15

The semi colon after the if statement ends the statement so: if ( num1 == num2 ); { printf( "%d is equal than %d\n", num1, num2 ); } is the same as if ( num1 == num2 ){ ; /* Do nothing */ } printf( "%d is equal than %d\n", num1, num2 ); An if statement does the bit following the condition if the condition is met This will work if ( ...


14

On my machine, where I've probably screwed around too much with 32 and 64 bit architecture files, I resolved this issue by installing g++-multilib.


12

The debtags package could be useful for this. debtags search devel::lang:c This will list all packages which have been tagged as written in C. apt-cache rdepends libc6 will show you all packages that depend on libc6.


12

You need to qualify your include #include <python2.7/Python.h> Or tell gcc where to find Python.h with the gcc -I /usr/include/python2.7/ program.c


11

I've asked the question on the ayatana mailing list and received an answer from Ted Gould: Unfortunately that's not possible today. It's been our intention to support custom menu items in dbusmenu so that you could do anything that your app needed for your application indicator (including using IDO) but I haven't found the time yet to complete it ...


11

Ok, I did intsall libc6-dbg like so sudo apt-get install libc6-dbg and valgrind seems to work fine. Thanks to the ubuntu forum link: http://ubuntuforums.org/showthread.php?t=1017692


11

Ubuntu is based on debian. This is an abridgment of Wikipedia: On 6 May 2009, it was announced that Debian would move from the GNU C Library to EGLIBC, citing problems with the development process of glibc. Debian and several of its derivatives now ship EGLIBC instead of glibc. EGLIBC is free software licensed under the GNU LGPL. These are the ...


10

apt-file search gives the information % apt-file search --regex /cairo.h$ libcairo2-dev: /usr/include/cairo/cairo.h Because of that execute sudo apt-get install libcairo2-dev and compile with g++ screenshot.cpp $(pkg-config --libs --cflags cairo)


10

See splint - a GPL rewrite of lint. However, splint does not fully support C99. It is recommended to use cppcheck.


9

These files are actually called stdin, stdout and stderr. The @ character is added by ls to tell you that they are symbolic links. ls -l would reveal that the targets of these symbolic links are /proc/self/fd/0, /proc/self/fd/1 and /proc/self/fd/2. /proc is a virtual filesystem provided by the kernel that shows information about the operating system. Among ...


8

Depending on library, ubuntu stores its libraries mainly in three locations /lib /usr/lib /usr/local/lib Following is from File System Hierarchy Standard /lib The /lib directory contains those shared library images needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin. /usr/lib ...


8

Based on your comments to your question, I think what you are really asking is "How do I install a custom library I wrote and where should I put it?" In general, things built locally for others on the machine to user are put into the /usr/local tree. The header file should go into /usr/local/include. The compiled library should go into /usr/local/lib. ...


8

With all recent versions of GCC, when you use the math library, you have to explicitly link to it (it is not automatically linked to along with the rest of the standard C library). If you are compiling on the command-line with the gcc or g++ command, you would accomplish this by putting -lm at the end of the command. For example: gcc -o foo foo.c -lm


8

If you have the vim editor installed, open the file with vim file.c and type ==G to indent the file from begin to end. Then save it with :wq. On default installations, vi (not vim) is installed, this requires the ident package mentioned by karel.


8

Since you want to learn bash internal source code, let's get it first with: apt-get source bash && cd bash-4.3 I'm running 14.04 and I now have a folder named bash-4.3. Prefer the apt-get source solution as it will apply all the patches that the Ubuntu package version provides. Now modify the following files: Index: bash-4.3/bashhist.c ...


7

Find package from file Edit: This only works for an installed package, so is not able to answer the question. Better is heartmagic's answer To find out what package a file is part of, you can use dpkg -S <file name> For example, dpkg -S curses.h gives me this output: libncurses5-dev: /usr/include/ncurses.h libncurses5-dev: /usr/include/curses.h ...


7

Well, it depends what you want to read it for? Almost all programs just rely on $TZ being set in the environment or /etc/localtime being a link to a timezone file. The C library will then automatically arrange for eg localtime() to return the correct time. 1) How can I basically read above type of files zdump -v /etc/localtime will show you what's ...


7

When you run commands on Linux it searches all the directories listed in the PATH environment variable, and if it doesn't find the command there then you get the message you've seen. Typically it looks like this: PATH=/usr/local/bin:/usr/bin:/bin That means it will look first in /usr/local/bin. If it doesn't find it there it'll look in /usr/bin, and so ...


7

Valgrind is installable from repository(tested on 12.04 running kernel 3.2.x). sudo apt-get install valgrind. Also available in 11.10 according to this. Just an additional note, it's not a debugger. It's a memory fault detector.


7

gcc uses the file extension (suffix) to determine the type - did you name your file with a .c suffix? If not, try renaming it - for example if I have a file called 'testc' $ cat testc #include<stdio.h> int main() { printf("THIS is a C-file\n"); return 0; } Then $ gcc -o test testc testc: file not recognized: File format not recognized collect2: ld ...


7

You need to install the lapack and libblas. sudo apt-get install build-essential sudo apt-get install liblapack* sudo apt-get install libblas* The real trick lies in calling the library functions and link them. LAPACK Header No special header is required, Only usual headers will be there. #include <stdio.h> #include <math.h> Function ...


7

I got the same result by using package manager. I did the following: sudo apt-get install libblas-dev checkinstall sudo apt-get install libblas-doc checkinstall sudo apt-get install liblapacke-dev checkinstall sudo apt-get install liblapack-doc checkinstall The libraries went in /usr/lib and the includes in /usr/include. Thanks to Markus-Hermann for the ...



Only top voted, non community-wiki answers of a minimum length are eligible