By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

How to handle this problem in MS VC++

P: n/a
Hi, everyone,

Suppose the following simple program:

#include "engine.h"

int main()
{
Engine *ep;

if (!(ep = engOpen(NULL))) {
printf("Can't start MATLAB engine");
exit(-1);
}

engClose(ep);
return(0);
}

When I was trying to compile and link the program:

Linking...
engwindemo.obj : error LNK2001: unresolved external symbol _engClose
engwindemo.obj : error LNK2001: unresolved external symbol _engOpen
Debug/engwindemo.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

engwindemo.exe - 3 error(s), 0 warning(s)

Then I found "engClose" and "engOpen" are defined in "liben.def",
which in turn is directed to "libeng.dll" as indicated by the
following information.

LIBRARY libeng.dll
EXPORTS
_engClose=engClose
....
_engOpen=engOpen
....
_libeng_build_date=libeng_build_date
_libeng_version=libeng_version

I added all these two files into the project, but still the linking
error information appears. I wonder whether I have put the
"libeng.dll" into a wrong directory, that is, I should not add
"libeng.dll" into the project, but put it into some other proper
directory instead so that MS VC++ can find it when linking. Could
anyone give me some hints on this? Thanks a lot.

VB
/Cris
Nov 14 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cris Ding <cr*******@mh.se> scribbled the following:
Hi, everyone, Suppose the following simple program: #include "engine.h" int main()
{
Engine *ep; if (!(ep = engOpen(NULL))) {
printf("Can't start MATLAB engine");
exit(-1);
} engClose(ep);
return(0);
} When I was trying to compile and link the program: Linking...
engwindemo.obj : error LNK2001: unresolved external symbol _engClose
engwindemo.obj : error LNK2001: unresolved external symbol _engOpen
Debug/engwindemo.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe. engwindemo.exe - 3 error(s), 0 warning(s) Then I found "engClose" and "engOpen" are defined in "liben.def",
which in turn is directed to "libeng.dll" as indicated by the
following information.


You'll want to link the "libeng.dll" library. How to do this is none
of comp.lang.c's business, as it's specific to MSVC++.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"To doo bee doo bee doo."
- Frank Sinatra
Nov 14 '05 #2

P: n/a
On 17 Feb 2004 12:53:01 -0800, in comp.lang.c , cr*******@mh.se (Cris Ding)
wrote:
Then I found "engClose" and "engOpen" are defined in "liben.def",
which in turn is directed to "libeng.dll" as indicated by the
following information.


This would be a Windows question. You need to ask it over there.

(by the way the function's runtime code may be in the DLL but you still
need a .lib file to link with, unless you're doing /real/ dynamic loading,
which you're not. The .lib contains the stub loader for the DLL code).
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.