BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Calling Matlab External Engine from C++ GUI

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Jimbob Wallace
Guest





PostPosted: Tue Dec 20, 2005 12:51 pm    Post subject: Calling Matlab External Engine from C++ GUI Reply with quote




Hi
I'm trying to make external calls to the Matlab engine from a GUI developed in C++ Builder 6. I'm having a problem with file linkage. This is the post I put onto the Matlab areas:

Quote:

I am trying to use the Matlab External Interface to develop a GUI in

Borland C++ Builder 6 that will make external calls to the Matlab
Engine (7 release14). I am getting the following errors:

[C++ Warning] Unit1.cpp(22): W8060 Possibly incorrect assignment
[C++ Warning] Unit1.cpp(25): W8004 'ep' is assigned a value that is
never used
[Linker Error] Unresolved external '_engOpen' referenced from
C:PROGRAM FILESBORLANDCBUILDER6PROJECTSUNIT1.OBJ

Steps followed:

Have Matlab 7 release 14 and Borland C++ Builder 6 operating on Windows
XP Pro

1. I add a test button to the form
2. Add #include "engine.h" to top of cpp file
3. Add the following code to the test buttons fast call for click:

Engine *ep;
if (!(ep = engOpen(NULL))) {

}

4. Copied over library files required by libeng, as in guide
5. Typed matlab /regserver at C:MATLAB7binwin32 in command prompt to
register, as instructed in Help file - engOpen (External Interfaces
Reference). Result was to open a Matlab Command Window.
6. In C++ Builder, Project->Options - Directories/Conditionals tab
added following paths:
7. Include path: C:MATLAB7externinclude

Library path: C:MATLAB7externlibwin32borlandbc54 (I am using
version Borland C++ v6. I tried other options, bc50 and bc53 with same
problem. This is the only place where I can see an obvious problem.
Do I need a path with bc60 or similar? If so where can I get it?)
C:MATLAB7binwin32
8. Set the path environment variable in Control Panel
9. Tried compiling and got errors as above.

I have seen that this is quite a common query on this forum. The only
clue that I have is there is no bc60 path in lib.
Quote:


I am pretty new to C++ as well as Builder. Someone suggested that I need to tell it to link to the libeng.lib. Does this sound right and if so how do I do it?

I hope this post is in the correct borland.public.cppbuilder.* area. If not can you direct me to the correct one

Thanks in advance

Jimbob


Back to top
Bob Gonder
Guest





PostPosted: Tue Dec 20, 2005 4:14 pm    Post subject: Re: Calling Matlab External Engine from C++ GUI Reply with quote



Jimbob Wallace wrote:

Quote:
Engine *ep;
if (!(ep = engOpen(NULL))) {

[C++ Warning] Unit1.cpp(22): W8060 Possibly incorrect assignment

Correct, it looks to the compiler like you meant ==
Try being more explicit:
if ( 0 == (ep = engOpen(NULL) ) )
Quote:
}

[C++ Warning] Unit1.cpp(25): W8004 'ep' is assigned a value that is
never used

Correct. You never use it after assigning to it.
Add more code that actually uses ep.
Or remove ep from the program altogether:
if ( 0 == engOpen(NULL) ) )

Quote:
[Linker Error] Unresolved external '_engOpen' referenced from

I am pretty new to C++ as well as Builder. Someone suggested that I need to tell it to link to the libeng.lib.
Does this sound right and if so how do I do it?

Yes. Add the lib to your project window.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.