- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page