1

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.o: In function `num_to_cstr':

chain.c:(.text+0x682): undefined reference to `log10'

collect2: error: ld returned 1 exit status  

However, I can do the exact same build in Debian Stretch or macOS Sierra, and it will find the symbols.

2

2 Answers 2

0

Adding this here from a comment as it was not posted as an answer. Had to read the comments to resolve the issue. I was working on regldg (http://regldg.com/docs/command_line_args.php) which had the same issue. I did add #include "stdint.h" in the code, but I suspect adding -lm after the command manually is what fixed the problem

"putting -lm after everything else fixed it."

For regldg, the solution was:

gcc -O3 -Wall -g alt.o altlist.o build_structs.o char_set.o data.o debug.o grouplist.o grouprecord.o main.o memory.o parse_regex.o program_args.o re_perm.o silist.o tnode.o vlr.o vlrlist.o -o regldg -lm
0

Steps: 1. Open Terminal on your file Location 2. Command --> gcc filename.c -lm 3. a.out File is Created on your file location 4. Execute The File Command --> ./a.out 5. View on the Output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .