Fortran/C: clock() function in msvcrt.lib

Fortran/C: clock() function in msvcrt.lib

Imagen de gib

I found that to build my Fortran program, which links to a C library, it was necessary to ignore msvcrt.lib, otherwise I get linker errors about functions being already defined in LIBCMT.lib.  Now I want to use clock() in the C code, but the linker says:

Error    1     error LNK2001: unresolved external symbol __imp__clock    cvReactDiff-lib.lib(cvReactDiff_bnd.obj)    

If I stop ignoring msvcrt.lib I don't get this error, but 10 others instead.  I don't understand why clock() is singled out - I'm using many other functions in the C runtime library.  Is there a way to get around this?

Thanks

Gib

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Tim Prince

Did you check that your C and Fortran projects are set consistently to /MT (static link) or /MD (dynamic link)?
The error checking may "single out" the first problem encountered.

Imagen de gib

That was easy! The library was /MD, should have been /MT. Now it works.

I don't understand why it built successfully until I added the clock() call, since I'm using many other functions from the run-time library, but I will not lose sleep over it.

Thanks Tim.

Inicie sesión para dejar un comentario.