Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MathLink with MS Visual Studio 2008

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85385] Re: MathLink with MS Visual Studio 2008
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 7 Feb 2008 22:34:03 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <fo1a3l$g38$1@smc.vnet.net> <fo9ftn$s9u$1@smc.vnet.net> <foekjj$i88$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

you must look at the outout C/C++ file from mprep
it assume 8 bit characters, but Visual Studio by default
assume unicode, i.e., 16 bit charaters. When VS assume
unicode the header of VS contain a switch, that
call the unicode version of WinMain() and this clashes
with the definitions that mprep insert in your final
C/C++ file

Regards
   Jens

Steve Luttrell wrote:
> Thanks for that.
> 
> I have no idea where you found out about $(NOINHERIT), it's not in 
> tutorial/MathLinkDeveloperGuide-Windows, but it worked for me.
> 
> Stephen Luttrell
> West Malvern, UK
> 
> "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de> wrote in message 
> news:fo9ftn$s9u$1 at smc.vnet.net...
>> Hi,
>>
>> it is the same as with VS 2005, you must switch of the
>> unicode maros in the Microsoft header with
>> $(NOINHERIT)
>> in your preprocessor definitions.
>>
>> Regards
>>   Jens
>>
>> Steve Luttrell wrote:
>>> I use Mathematica 6 with Windows Vista.
>>>
>>> I have just downloaded MS Visual C++ 2008 Express to set it up to work 
>>> with
>>> MathLink. It installs itself along with the MS Visual Studio 2008
>>> development environment. The documentation for Mathematica 6 (see
>>> tutorial/MathLinkDeveloperGuide-Windows) assumes you have MS Visual 
>>> Studio
>>> 2005 (note 2005, NOT 2008), but I hoped that any differences between the
>>> 2005 and 2008 versions would be minor, so I set about getting the addtwo
>>> example to work. BTW, the prebuilt addtwo example works OK for me.
>>>
>>> I followed all of the instructions in
>>> tutorial/MathLinkDeveloperGuide-Windows for setting up an addtwo project
>>> without any problems, except for:
>>> (1) In the additional dependencies step (step 16 of the instructions) I
>>> found that ml32i3.lib does NOT exist, so I used ml32i3m.lib instead.
>>> (2) In the custom build step (step 21 of the instructions) I had to use
>>> explicit paths rather than the cleverly constructed paths that were
>>> suggested.
>>>
>>> I then built addtwo.exe, and there were no errors but a lot of warnings 
>>> (see
>>> the transcript below). I then tried to install addtwo in a fresh 
>>> Mathematica
>>> session, but the install hung up on me and never returned.
>>>
>>> Presumably there is an installation detail that is somehow different for 
>>> the
>>> MS Visual Studio 2008 version (compared to the 2005 version), but there 
>>> are
>>> so many things that I could tweak that I don't know where to begin.
>>>
>>> Can anyone help?
>>>
>>> addtwo build transcript:
>>>
>>> 1>------ Rebuild All started: Project: addtwo, Configuration: Debug
>>> Win32 ------
>>> 1>Deleting intermediate and output files for project 'addtwo', 
>>> configuration
>>> 'Debug|Win32'
>>> 1>Performing Custom Build Step
>>> 1>Compiling...
>>> 1>addtwo.c
>>> 1>addtwotm.c
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(75) : warning C4133: 'function' : incompatible
>>> types - from 'char [7]' to 'LPCWSTR'
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(78) : warning C4133: 'function' : incompatible
>>> types - from 'char [260]' to 'LPWCH'
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(88) : warning C4133: 'function' : incompatible
>>> types - from 'char [7]' to 'LPCWSTR'
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(93) : warning C4133: '=' : incompatible types - 
>>> from
>>> 'LPSTR' to 'LPCWSTR'
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(94) : warning C4133: '=' : incompatible types - 
>>> from
>>> 'char [10]' to 'LPCWSTR'
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(100) : warning C4133: 'function' : incompatible
>>> types - from 'char [10]' to 'LPCWSTR'
>>> 1>c:\users\steve luttrell\documents\temp\visual c++
>>> 2008\addtwo\addtwotm.c(100) : warning C4133: 'function' : incompatible
>>> types - from 'char *' to 'LPCWSTR'
>>> 1>addtwotm.c(480) : warning C4133: 'function' : incompatible types - from
>>> 'char [64]' to 'LPWSTR'
>>> 1>addtwotm.c(492) : warning C4133: 'function' : incompatible types - from
>>> 'char [64]' to 'LPCWSTR'
>>> 1>Generating Code...
>>> 1>Compiling manifest to resources...
>>> 1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
>>> 1>Copyright (C) Microsoft Corporation.  All rights reserved.
>>> 1>Linking...
>>> 1>Embedding manifest...
>>> 1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
>>> 1>Copyright (C) Microsoft Corporation.  All rights reserved.
>>> 1>Build log was saved at "file://c:\Users\Steve
>>> Luttrell\Documents\Temp\Visual C++ 2008\addtwo\Debug\BuildLog.htm"
>>> 1>addtwo - 0 error(s), 9 warning(s)
>>> ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
>>>
>>> Stephen Luttrell
>>> West Malvern, UK
>>>
>>>
> 
> 


  • Prev by Date: Re: Re: Mathematica 6.0.0 no graphics output on Windows XP
  • Next by Date: Re: NIntegrate - bug??
  • Previous by thread: Re: MathLink with MS Visual Studio 2008
  • Next by thread: Re: Re: MathLink with MS Visual Studio 2008