comp.soft-sys.matlab
[Top] [All Lists]

Re: error LNK2001: unresolved external symbol

Subject: Re: error LNK2001: unresolved external symbol
From: "Markus"
Date: Fri, 23 Sep 2005 11:54:26 +0300
Newsgroups: comp.soft-sys.matlab
"Bull Dog" <ku.oc.balrs@xxxxxxxxxxxxx> wrote in message 
news:ef15c9a.7@xxxxxxxxxxxxxxxxxxx
> Markus wrote:
>
>> If you could provide *minimal* C code causing the error I could
>> look into
>> it although I am using VS.NET2003. Still, it might give the same
>> error
>> if it's in standard libraries...
>>
>
> That's going to be problematic. My source code (actually in CPP) is
> 6 files long and heavily embedded. It would be difficult for me to
> strip out the bits that aren't used (probably not that much can be
> stripped out anyway). Plus, there's the issue of IPR so I may not be
> allowed to do that (I guess you could say it's OK as long as no one
> knows...).
>
> I'm guessing the problem is with MFC. That is probably why it
> compiles ok from VS IDE but not through Matlab.
>
> In my mexopts.bat file (which I only just figured out how to edit!) I
> have items missing for the fields LINKOPTIMFLAGS, LINK_FILE and
> LINK_LIB. There is also no mention of MFC anywhere. Am I on the
> right track, do you think?

Yes you are.  I also have nothing specified in those fields you mention.

What I usually do is download the latest Platform SDK from Microsoft
and put its include and lib folders into mexopts.bat file. More precisely
I have:

set 
INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include;%INCLUDE%
set 
LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib;%MATLAB%\extern\lib\win32;%LIB%;

This makes the compiler and linker use the latest headers and libraries.

I have never used MFC in mex files so I can't really help on that. But look 
into
/MD versus /MT switches in MSDN.

As a general rule of thumb I would suggest you start working on a minimal
mex code to make sure your setup is ok. It sounds like your current code is
quite complicated to work with.




<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy