linux compile problem

    技术2026-05-16  7

      1, When I compile the c file using gcc ,I met with the error that :"ld:undefined reference to "atan"",but I had included the math.h in the C file.

        Finally, I found there is someting wrong with the option of link .Add the "-lm" to the compile instruction is the solution !

    2, another problem I have met when compile my code: "relocation truncated to fit: R_X86_64_32.", which probably because that I have defined a big global array which exceeds the limit of the compiler.

          solution:   add "-mcmodel=medium" to the compile instruction.

    最新回复(0)