'Build file: "no target" in "no project" (compiler: unknown)

I wrote a code in c/c++. After correcting all the errors, I tried to compile and build it and I get this error log:

-------------- Build file: "no target" in "no project" (compiler: unknown)---------------

gcc -std=c11  -c /sysroot/home/arij/tryvache.c -o /sysroot/home/arij/tryvache.o
gcc  -o /sysroot/home/arij/tryvache /sysroot/home/arij/tryvache.o   
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld : /sysroot/home/arij/tryvache.o : dans la fonction « vache » :
tryvache.c:(.text+0x130) : référence indéfinie vers « pow »
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld : tryvache.c:(.text+0x1f7) : référence indéfinie vers « pow »
collect2: erreur: ld a retourné le statut de sortie 1
      Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

What is wrong here?



Solution 1:[1]

Looking at the error message you have posted in the OP, I think it translates to

tryvache.c:(.text+0x130) : Undefined reference to 'pow' 

used in tryvache.c

You must compile the code with flag -lm which instructs your compiler (gcc) to link with math library which contains pow() function.

If you have written the makefile all by yourself then you can simply add -lm as instructed in the comment above. If you are using an IDE like eclipse, then you will have to go though compiler options and/or build settings to find a correct section where the linker flags (such as -lm) needs to be added.

On eclipse IDE these are usually at GCC C Linker > libraries under the C/C++ Build settings.

Side note: It will be better if you setup your toolchain in English, if not, at least translate the errors for the people trying to solve your problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1