- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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 kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Those symbols are in libmat.lib and libmx.lib. Did you leave the .lib files in the additional dependencies line?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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".
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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).
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Thank you Ian, It works!

- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite