- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm new in this thing, so be gentle with me...
I wrote a mixed Fortran and VC++ code (The VC++ calls the Fortran routines).
When I'm using a mathematical function (e.g. tan,cos etc.) in my C++ code I get the following error message:
dfor.lib(matherr.obj) : error LNK2005: __matherr already defined in LIBCD.lib(matherr.obj)
According to a search on the web I should include dfor.lib inside my linking libraries of the C++ project, but still I get this message.
My C++ linking definitions are:
dfor.lib FortranMain.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/TBWmain.pdb" /debug /machine:I386 /nodefaultlib:"msvcrtd.lib"
My Fortran compilation setting are:
/check:bounds /compile_only /debug:full /include:"Debug/" /nologo /traceback /warn:argument_checking /warn:nofileopt /module:"Debug/" /object:"Debug/" /pdbfile:"Debug/DF60.PDB"
Thanks for any help!
OG
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is the compilation settings that are most important. The run-time library type must match between Fortran (Libraries) and C++ (Code Generation). If you are building a Debug configuration, then "Single-Threaded Debug (/ML)" will probably work for you. (You are using CVF - if you were using Intel Fortran I would recommend "Multithreaded Debug" as the single-threaded static libraries don't exist in VS2005 or later.)

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