
Ubuntu 14.04에서 Ubuntu 16.04로 업그레이드하기 전에 mingw-64-gcc를 사용하여 다음 코드를 컴파일할 수 있었습니다.
x86_64-w64-mingw32-gcc -fprofile-generate -o test.exe test.c -lgcov -static
//test.c
#include <stdio.h>
int main(void)
{puts("test");return 0;}
이제 __gcov 기호 누락으로 인해 프로그램을 연결할 수 없습니다.
x86_64-w64-mingw32-gcc -fprofile-generate -o test test.c
/tmp/cccj8pnx.o:test.c:(.text+0x1a): undefined reference to `__gcov_indirect_call_profiler_v2'
/tmp/cccj8pnx.o:test.c:(.text+0x46): undefined reference to `__gcov_time_profiler'
/tmp/cccj8pnx.o:test.c:(.data+0xa0): undefined reference to `__gcov_merge_time_profile'
/tmp/cccj8pnx.o:test.c:(.rdata$.refptr.__gcov_indirect_call_callee[.refptr.__gcov_indirect_call_callee]+0x0): undefined reference to `__gcov_indirect_call_callee'
collect2: error: ld returned 1 exit status
두 Ubuntu 버전 간에 변경된 사항은 무엇입니까? 어떤 도움이라도 주시면 감사하겠습니다.
답변1
-fprofile-arcs
나는 이와 같은 문제에 부딪혔고, 가 아닌 에 연결하여 문제를 해결할 수 있었습니다 -lgcov
.