C ++ and Fortran mixed programming the problem of CPP file calling mathematical functions

xiaoxiao2021-03-06  23

----------------------------- File: a.cpp ------------- # include #include Extern "C" {void _stdcall testa (int *);} void main () {double a = sin (1.00); cout << "a =" << a; INT II = 1; Testa (& II);

------------------------------ File: BF ------------- Subroutine Testa (IA Write (*, *) "IA =", irateturnend compiles error: lineing ... dfor.lib (Matherr.obj): Error LNK2005: __matherr already defined in libcd.lib (Matherr.obj) link: warning lnk4098: defaultlib "libc.lib" conflicts with use of other libs; use /NODEFAULTLIB:libraryDebug/StaggeredGrid.exe: fatal error LNK1169: one or more multiply defined symbols foundError executing link.exe the analysis found that because the main function call inside. SIN math function, the solution is to add a file header: #pragma comment (lib, "dfor")

转载请注明原文地址:https://www.9cbs.com/read-39652.html

New Post(0)