Only when I'm trying to compile + link to the pthread library, I'm getting this error from Emacs:
-*- mode: compilation; default-directory: "~/GITHUB/kandr/" -*-
Compilation started at Mon Nov 14 02:50:59
cc -Wall -Wextra -pedantic -std=c11 -g -lpthread how_to_thread.c -o ./bin/how_to_thread
/usr/bin/ld: ne peut ouvrir le fichier de sortie ./bin/how_to_thread: Aucun fichier ou dossier de ce type
collect2: error: ld returned 1 exit status
Compilation exited abnormally with code 1 at Mon Nov 14 02:50:59
I tried to type the same command: cc -Wall -Wextra -pedantic -std=c11 -g -lpthread how_to_thread.c -o ./bin/how_to_thread
directly from the command line, and I have no error, the compilation went fine.
The problem seems to occur only when I need to link (-lpthread). Compiling from Emacs a simple c source code, wich doesn't need a library to be linked brings not compilation errors. Is there something I'm doing wrong?
cc
in a file, saybuildcommand
, and then runcc @buildcommand
from both inside and outside emacs to eliminate transcription errors. Then add a-###
or-v
to the commands and compare the outputs to see if different versions are being invoked? Does adding a-lc
to asimple c source code
compile cause it to break? – icarus Nov 14 '16 at 16:01