Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Compile error with Fortran 11.1 and R2009b

Subject: Compile error with Fortran 11.1 and R2009b

From: DJ

Date: 14 Oct, 2009 15:47:01

Message: 1 of 6

Hello,

I'm trying to create a mex file on a .f90 file which compiles in Fortran using Microsoft Visual Studios 2008. I keep receiving the error:

LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

I've tried using -Ipathname, -lname, and -Ldirectory to specify where Kernel32.Lib is, but that doesn't seem to work either. Here are the steps I've taken:

mex -setup
Please choose your compiler for building external interface (MEX) files:
 
Would you like mex to locate installed compilers [y]/n? y
 
Select a compiler:
[1] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) in C:\Users\DJ Ferris\Desktop\Compiler\11.1\048\
[2] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2009b\sys\lcc
[3] Microsoft Visual C++ 2008 SP1 in C:\Program Files\Microsoft Visual Studio 9.0
 
[0] None
 
Compiler: 1
 
Please verify your choices:
 
Compiler: Intel Visual Fortran 11.1
Location: C:\Users\DJ Ferris\Desktop\Compiler\11.1\048\
 
Are these correct [y]/n? y
 
Trying to update options file: C:\Users\DJ Ferris\AppData\Roaming\MathWorks\MATLAB\R2009b\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2009b\bin\win32\mexopts\intelf11msvs2008opts.bat

mex 'C:\Users\DJ Ferris\Documents\Visual Studio 2008\Projects\Console2\Console2\Console2.f90'
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
 
  C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'Console2.mexw32' failed.
 
??? Error using ==> mex at 221
Unable to complete successfully.

mex -Ldirectory 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib'
LINK : fatal error LNK1181: cannot open input file 'C:\PROGRA~1\MI2578~1\WINDOWS\V6.0A\Lib.obj'
 
  C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of '.mexw32' failed.
 
??? Error using ==> mex at 221
Unable to complete successfully.
 
>> mex -lname 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\Kernel32.Lib'
 
Warning: MEX could not find the library "name"
         specified with -l option on the path specified
         with the -L option.
LINK : warning LNK4001: no object files specified; libraries used
LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
LINK : error LNK2001: unresolved external symbol MEXFUNCTION
C:\USERS\DJFERR~1\APPDATA\LOCAL\TEMP\MEX_DJ~1\templib.x : fatal error LNK1120: 1 unresolved externals
 
  C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'Kernel32.mexw32' failed.
 
??? Error using ==> mex at 221
Unable to complete successfully.

Thanks for your help.

DJ Ferris

Subject: Compile error with Fortran 11.1 and R2009b

From: chris

Date: 25 Oct, 2009 07:22:19

Message: 2 of 6

Hi,

Check this thread: http://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/60737/ - it may be an issue with your installation of Visual Studio 2008.

HTH


"DJ " <emailstartsafter.ferrisdj@colorado.edu> wrote in message <hb4rpl$iak$1@fred.mathworks.com>...
> Hello,
>
> I'm trying to create a mex file on a .f90 file which compiles in Fortran using Microsoft Visual Studios 2008. I keep receiving the error:
>
> LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
>
> I've tried using -Ipathname, -lname, and -Ldirectory to specify where Kernel32.Lib is, but that doesn't seem to work either. Here are the steps I've taken:
>
> mex -setup
> Please choose your compiler for building external interface (MEX) files:
>
> Would you like mex to locate installed compilers [y]/n? y
>
> Select a compiler:
> [1] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) in C:\Users\DJ Ferris\Desktop\Compiler\11.1\048\
> [2] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2009b\sys\lcc
> [3] Microsoft Visual C++ 2008 SP1 in C:\Program Files\Microsoft Visual Studio 9.0
>
> [0] None
>
> Compiler: 1
>
> Please verify your choices:
>
> Compiler: Intel Visual Fortran 11.1
> Location: C:\Users\DJ Ferris\Desktop\Compiler\11.1\048\
>
> Are these correct [y]/n? y
>
> Trying to update options file: C:\Users\DJ Ferris\AppData\Roaming\MathWorks\MATLAB\R2009b\mexopts.bat
> From template: C:\PROGRA~1\MATLAB\R2009b\bin\win32\mexopts\intelf11msvs2008opts.bat
>
> mex 'C:\Users\DJ Ferris\Documents\Visual Studio 2008\Projects\Console2\Console2\Console2.f90'
> LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
>
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'Console2.mexw32' failed.
>
> ??? Error using ==> mex at 221
> Unable to complete successfully.
>
> mex -Ldirectory 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib'
> LINK : fatal error LNK1181: cannot open input file 'C:\PROGRA~1\MI2578~1\WINDOWS\V6.0A\Lib.obj'
>
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of '.mexw32' failed.
>
> ??? Error using ==> mex at 221
> Unable to complete successfully.
>
> >> mex -lname 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\Kernel32.Lib'
>
> Warning: MEX could not find the library "name"
> specified with -l option on the path specified
> with the -L option.
> LINK : warning LNK4001: no object files specified; libraries used
> LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
> LINK : error LNK2001: unresolved external symbol MEXFUNCTION
> C:\USERS\DJFERR~1\APPDATA\LOCAL\TEMP\MEX_DJ~1\templib.x : fatal error LNK1120: 1 unresolved externals
>
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'Kernel32.mexw32' failed.
>
> ??? Error using ==> mex at 221
> Unable to complete successfully.
>
> Thanks for your help.
>
> DJ Ferris

Subject: Compile error with Fortran 11.1 and R2009b

From: Felix Maximilian Möller

Date: 24 Mar, 2010 16:15:22

Message: 3 of 6

Hey,

where did you get the intelf11msvs2008opts.bat? I am searching for this for hours!

I have the intel visual fortran compiler in version 11.1 and visual studio 2008 but don´t get mex -setup find the fortran comiler. Just c++ is listed.

greetz,
Maximilian

Subject: Compile error with Fortran 11.1 and R2009b

From: Christopher Rice

Date: 14 Sep, 2010 02:06:20

Message: 4 of 6

"Felix Maximilian Möller" <felixmaximilian@gmail.com> wrote in message <hoddqq$5l6$1@fred.mathworks.com>...
> Hey,
>
> where did you get the intelf11msvs2008opts.bat? I am searching for this for hours!
>
> I have the intel visual fortran compiler in version 11.1 and visual studio 2008 but don´t get mex -setup find the fortran comiler. Just c++ is listed.
>
> greetz,
> Maximilian

Max:

Make sure your version of MATLAB supports Intel Fortran 11.1 (2010a is the first???) I had 2009 and upgrading my version of MATLAB fixed the same problem you describe.

JD:

Have you solved the kernel32.lib issue? I am having the same problem and cannot seem to fix it.

Subject: Compile error with Fortran 11.1 and R2009b

From: Christopher Rice

Date: 14 Sep, 2010 04:47:04

Message: 5 of 6

> Max:
>
> Make sure your version of MATLAB supports Intel Fortran 11.1 (2010a is the first???) I had 2009 and upgrading my version of MATLAB fixed the same problem you describe.
>
> JD:
>
> Have you solved the kernel32.lib issue? I am having the same problem and cannot seem to fix it.

Well, it turns out the problem was in the install of VS2008. o fix the problem, I "reinstalled" my copy of VS 2008, then "repaired" the Intel Fortran compiler, then finally started MATLAB and ran mex -setup.

At last, I am making MEX files...

Subject: Compile error with Fortran 11.1 and R2009b

From: hamid mehdizadeh

Date: 17 Nov, 2011 16:04:13

Message: 6 of 6

Hi dudes
I have also:
Win7, 64
Matlab 2010a
Intel visual fortran 11.1.0.64
VS 2008 Prof.

But I can't make intel as my compiler to compile my fortran file to mex64. I'm pretty sure that file is correct, because I have converted it to mex32 on another system without any problem. Would please help me?

"C Rice" wrote in message <i6muo8$8p3$1@fred.mathworks.com>...
> > Max:
> >
> > Make sure your version of MATLAB supports Intel Fortran 11.1 (2010a is the first???) I had 2009 and upgrading my version of MATLAB fixed the same problem you describe.
> >
> > JD:
> >
> > Have you solved the kernel32.lib issue? I am having the same problem and cannot seem to fix it.
>
> Well, it turns out the problem was in the install of VS2008. o fix the problem, I "reinstalled" my copy of VS 2008, then "repaired" the Intel Fortran compiler, then finally started MATLAB and ran mex -setup.
>
> At last, I am making MEX files...

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us