- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to create mat file from Fortran data using Matdata.
It needs libmat.lib, libmx.lib from Matlab library and libmat.dll and libmx.dll from Matlab bin directories. On the command line mode, where I set PATH and LIB of these files*, everything is OK. But when I am trying to run it from VS shell in the form of VF project, I get fatal errorLNK1107: invalid or corrupt file for dll file: cannot read at 0x2C8. The properties of the project have been configured by adding library directory and files (Attached Figs. 1,2)
Thank you
* set LIB=%LIB%;C:\Program Files\MATLAB\R2012a\extern\lib\win64\microsoft and set PATH=%PATH%;C:\Program Files\MATLAB\R2012a\extern\lib\win64\microsoft
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are specifying the path to the 64 bit libraries ("C:\...MATLAB\R2014b\extern\lib\win64\...") for a 32 bit build (the platform in VS is Win32).
Are you trying to build for 32 bit or 64 bit?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove the .DLL files from the additional dependencies property.
On Windows you link against an import library for a DLL (.lib extension), not directly against the DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those symbols are in libmat.lib and libmx.lib. Did you leave the .lib files in the additional dependencies line?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also removed libmat.lib and libmx.lib from the additional dependencies in Linker/Input and I got the same errors (Fig. 3). Now, the only change in project properties is Matlab library path in Linker/General/"Additional library directories".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't remove them - the .lib files need to be listed in the additional dependencies for the project that links MatData.obj.
If you are still having issues provide additional information about your project, for example by attaching the .vfproj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kami M: You have not absorbed a rather basic concept. You have to specify both which non-default libraries are to be linked with, and where those libraries are located. What you said #5, in effect, is "look for the additional libraries here <...>, but right now I don't need any". Simply add the import library names (not the DLL names) the "additional dependencies" list.
A similar situation exists w.rt. (i) include files and module files at compile time, and (ii) DLLs at run time. Include and module file requirements are embedded in the source code thorugh INCLUDE and USE statements. The information about DLL dependencies in the EXE you build is placed into the EXE by the linker, and the system loads those DLLs as needed by looking at the PATH environmental variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4: Thank you for your comment.
Actually, I did #5 just to show Ian that by removing/leaving lib files I get the same error message (Fig. 3). I added lib files and got the same error message. I think there is a mistake somewhere else. Attached is a simple example of my project (exporting 1,2 and 4D arrays to mat file).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are specifying the path to the 64 bit libraries ("C:\...MATLAB\R2014b\extern\lib\win64\...") for a 32 bit build (the platform in VS is Win32).
Are you trying to build for 32 bit or 64 bit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Ian, It works!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page