2
Fortran 서브 루틴을 호출하는 C 코드를 컴파일하려고하는데 항상 오류가 발생합니다. 나는 오류를컴파일 오류 : "_for_stop_core"을 찾을 수 없음
을 얻을!fort_sub.f90 module myadd use iso_c_binding implicit none contains subroutine add1(a) bind(c) implicit none integer (c_int),intent (inout) :: a a=a+1 if(a>10) then stop endif end subroutine add1 end module myadd
여기에 내가
ifort -c fort_subs.f90 icc main.cpp fort_subs.o
로를 컴파일 할 때 C 코드
//main.cpp extern "C"{ void add1(int * a); } int main(void){ int a=2; add1(&a); return 0; }
입니다 : 여기
은 포트란 코드Undefined symbols for architecture x86_64: "_for_stop_core", referenced from: _add1 in fort_subs.o ld: symbol(s) not found for architecture x86_64
내가
icc -c main.cpp
ifort -nofor-main fort_subs.f90 main.o
로를 컴파일 할 때 내가 거기 이러한 오류가 왜 오류가
어떻게 그들을 해결하는거야?Undefined symbols for architecture x86_64: "___gxx_personality_v0", referenced from: Dwarf Exception Unwind Info (__eh_frame) in main.o "___intel_new_feature_proc_init", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64
ibm 컴파일러에는 "_for_stop_core"오류를 해결하는 fortran 라이브러리를 링크하도록 c 컴파일러에 알리는 "-lxlf90"옵션이 있습니다. 인텔 C 컴파일러에 비슷한 옵션이 있습니까?
을 고려하는 것이 좋습니다 포트란 서브 루틴. 그리고 icc에게 Fortran 도서관을 연결시켜달라고 요청할 수 있어야합니다. 그 국기 알아? 나는 ibm 컴파일러에서'-lxlf90' 플래그를 사용하여 c 컴파일러에게 fortran 라이브러리를 연결하도록 알릴 수 있습니다. 또한 나는 실제 코드에서 많은 중지 문을 가지고 있으며, 수동으로 변경하는 것은 지루합니다. – xslittlegrass
@xslittlegrass : 나는 그것을 고려하지 않았다고 생각한다. (추후 참고 용으로 질문에 그와 같은 세부 사항은 언급 할 가치가있다.) 컴파일러 옵션'-lifcore'를 추가하여 프로그램을 컴파일하고 실행할 수있었습니다. –
그 - 리프 코어 무엇입니까? 내가 그것을 사용할 때 icc는 다음을 인식하지 못한다 : "ld : 라이브러리가 -lifcore에 없다" – xslittlegrass