Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Scilab configuration on Eclipse IDE for c++, Version Helios Service Release 2(Calling Scilab commands from c++)
Scilab configuration on Eclipse IDE for c++, Version Helios Service Release 2 [message #1753380] Sun, 05 February 2017 11:44 Go to next message
Van Pham is currently offline Van PhamFriend
Messages: 1
Registered: February 2017
Junior Member
Hi,

I am trying to compile a simple c++ code calling the Scilab commands, using Eclipse IDE for c++, Version Helios Service Release 2. The following errors show up:

**** Rebuild of configuration Debug for project scilab_sample ****

**** Internal Builder is used for build ****
g++ -IC:\Program Files (x86)\scilab-5.5.2\modules\api_scilab\includes -IC:\Program Files (x86)\scilab-5.5.2\modules\call_scilab\includes -IC:\Program Files (x86)\scilab-5.5.2\modules\core\includes -IC:\Program Files (x86)\scilab-5.5.2\libs -IC:\Program Files (x86)\scilab-5.5.2\bin -O0 -g3 -Wall -c -fmessage-length=0 -oscilab.o ..\scilab.cpp
..\scilab.cpp: In function 'int main()':
..\scilab.cpp:25:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
SendScilabJob("myMatrix=['sample','for the help']");
^
..\scilab.cpp:26:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
SendScilabJob("disp(myMatrix);"); // Will display !sample for the help !
^
..\scilab.cpp:27:39: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
SendScilabJob("disp([2,3]+[-44,39]);"); // Will display - 42. 42.
^
g++ -oscilab_sample.exe scilab.o
scilab.o: In function `main':
C:\Users\van\workspace\scilab_sample\Debug/../scilab.cpp:16: undefined reference to `StartScilab'
C:\Users\van\workspace\scilab_sample\Debug/../scilab.cpp:25: undefined reference to `SendScilabJob'
C:\Users\van\workspace\scilab_sample\Debug/../scilab.cpp:26: undefined reference to `SendScilabJob'
C:\Users\van\workspace\scilab_sample\Debug/../scilab.cpp:27: undefined reference to `SendScilabJob'
C:\Users\van\workspace\scilab_sample\Debug/../scilab.cpp:30: undefined reference to `TerminateScilab'
collect2.exe: error: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 4769 ms.

This is my code:

// A simple call_scilab example

#include <stdio.h> /* stderr */
#include "api_scilab.h" /* Provide functions to access to the memory of Scilab */
#include "call_scilab.h" /* Provide functions to call Scilab engine */

// Filename: simple_call_scilab.c

int main(void)
{
/****** INITIALIZATION **********/

#ifdef _MSC_VER
if ( StartScilab(NULL,NULL,NULL) == FALSE )
#else
if ( StartScilab(getenv("SCI"),NULL,NULL) == FALSE )
#endif
{
fprintf(stderr,"Error while calling StartScilab\n");
return -1;
}

/****** ACTUAL Scilab TASKS *******/

SendScilabJob("myMatrix=['sample','for the help']");
SendScilabJob("disp(myMatrix);"); // Will display !sample for the help !
SendScilabJob("disp([2,3]+[-44,39]);"); // Will display - 42. 42.

/****** TERMINATION **********/
if ( TerminateScilab(NULL) == FALSE ) {
fprintf(stderr,"Error while calling TerminateScilab\n");
return -2;
}
return 0;
}

I suspect I haven't configure the link correctly. Can anyone please help?

Many thanks,
Van
Re: Scilab configuration on Eclipse IDE for c++, Version Helios Service Release 2 [message #1761112 is a reply to message #1753380] Sun, 07 May 2017 02:53 Go to previous message
Chuck Pergiel is currently offline Chuck PergielFriend
Messages: 30
Registered: April 2016
Location: Silicon Forest
Member
First off, are you using C or C++? C++ uses
#include <iostream.h>

instead of
#include <stdio.h>


The linker cannot find the Scilab library. You need to add it to the configuration (Project / Properties / C/C++ Build / Settings / Tool Settings / GCC C Linker / Libraries). If the library is in a directory known to the linker, just adding the library name should be sufficient. Try it. If it doesn't work, you will need to add the path, or move the library to somewhere (where? I have no idea.) where where the linker can find it.

https://drive.google.com/file/d/0BxNrocOKYP7feGNqQWdSajdCaGc/view?usp=sharing



Sent from my Commodore-64 via a US Robotics 300 Baud Modem
Previous Topic:Eclipse Mars
Next Topic:How do you stop a runaway program?
Goto Forum:
  


Current Time: Tue Jun 15 01:38:25 GMT 2021

Powered by FUDForum. Page generated in 0.02458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top