Path: news.mathworks.com!not-for-mail
From: "Daniel Vogel" <vogel@stanford.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Linking C++ and Matlab using VS2003
Date: Tue, 3 Jun 2008 21:59:02 +0000 (UTC)
Organization: Stanford
Lines: 52
Message-ID: <g24er6$rgq$1@fred.mathworks.com>
Reply-To: "Daniel Vogel" <vogel@stanford.edu>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1212530342 28186 172.30.248.38 (3 Jun 2008 21:59:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 3 Jun 2008 21:59:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1405345
Xref: news.mathworks.com comp.soft-sys.matlab:472072



I'm trying to run the engdemo.c program. 
I'm using MATLAB 2008a and Microsoft C++ Visual Studio 2003 on a 
Windows XP machine.

At first I was getting the following error:
error C2065: 'Engine' : undeclared identifier

So i added the following line to my cpp file:
#include "C:/Program Files/MATLAB/R2008a/extern/include/engine.h"

But then I would start getting a couple of the following errors:
error LNK2019: unresolved external symbol _engClose referenced in function 
_main

So I added the following to my code:
#pragma comment (lib,"C:/Program Files/MATLAB/R2008a/extern/lib/win32/
microsoft/libeng.lib")
#pragma comment (lib,"C:/Program Files/MATLAB/R2008a/extern/lib/win32/
microsoft/libmx.lib")
#pragma comment (lib,"C:/Program Files/MATLAB/R2008a/extern/lib/win32/
microsoft/libut.lib")

This made the program link and compile. However, upon running the 
program, it would close with the following error:
Unable to Locate Component
This application has failed to start because libeng.dll was not found. Re-
installing the application may fix the problem.

So I copied libeng.dll from C:/Program Files/MATLAB/R2008a/bin/win32 to 
my project directory. It then asked me for another dll, which I also copied. 
This went on a couple of times until I got tired and copied over all the dlls in 
the win32 directory to my project directory. The program now opens and 
immediately crashes. A window pops up with the following message:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: c:\Documents and...
This application has requested the Runtime to terminate it in an unusual way. 
Please contact the application's support team for more information.

The output on my project window says:
Severe:
MATLAB:I18n:MissingICUData - ICU Data not found.
The program '[2760] c:\Documents and 
Settings\Administrator\Desktop\simple\PumaClient.exe: Native' has exited 
with code 2 (0x2).


I have read the "Compiling and Linking MATLAB? Engine Programs" section 
of the help. but I'm obviously confused and would really appreciate if you 
could walk me on this one...

Thank you very very much!