Getting started with Octave and Visual C++

classic Classic list List threaded Threaded
13 messages Options
n3t
Reply | Threaded
Open this post in threaded view
|

Getting started with Octave and Visual C++

n3t
Hello everybody,
this is my first message in this forum! I've a simple question for you: I know you can say "read the fucking manual", but the problem is that I've not found a fucking manual about this!

I want to create a C++ project using Visual Studio 2008 as IDE and Octave like scientifical/mathematical library.

So I downloaded "Octave 3.2.0 for Windows MinGW Installer" from SourceForge and setted the include directory. If I create a project with only
#include <octave/oct.h> and an empty main function,
it shows to me an huge number of incredible errors! So I think I've downloaded a wrong file or I made a mistake about setting Visual Studio..

How can explain to me what I've to do in order to achieve a good result?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

Søren Hauberg
søn, 21 06 2009 kl. 07:18 -0700, skrev n3t:
> So I downloaded "Octave 3.2.0 for Windows MinGW Installer" from SourceForge
> and setted the include directory. If I create a project with only
> #include <octave/oct.h> and an empty main function,
> it shows to me an huge number of incredible errors! So I think I've
> downloaded a wrong file or I made a mistake about setting Visual Studio..
>
> How can explain to me what I've to do in order to achieve a good result?

I'm not a Windows user, so I'm just guessing here... The 'MinGW
Installer' is (not surprisingly) compiled with MinGW. I'm guessing that
if you want to work with MSVC you'll need to compile Octave yourself
using this compiler. If you just want to use Octave from C++ or extend
Octave with something written in C++, then why not use MinGW instead of
MSVC?

Søren

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

Michael Goffioul
In reply to this post by n3t
On Sun, Jun 21, 2009 at 3:18 PM, n3t<[hidden email]> wrote:

>
> Hello everybody,
> this is my first message in this forum! I've a simple question for you: I
> know you can say "read the fucking manual", but the problem is that I've not
> found a fucking manual about this!
>
> I want to create a C++ project using Visual Studio 2008 as IDE and Octave
> like scientifical/mathematical library.
>
> So I downloaded "Octave 3.2.0 for Windows MinGW Installer" from SourceForge
> and setted the include directory. If I create a project with only
> #include <octave/oct.h> and an empty main function,
> it shows to me an huge number of incredible errors! So I think I've
> downloaded a wrong file or I made a mistake about setting Visual Studio..
>
> How can explain to me what I've to do in order to achieve a good result?

You can't use the octave version you downloaded with Visual Studio.
C++ ABI are not compatible. You must use MinGW.

Michael.
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
n3t
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

n3t
In reply to this post by Søren Hauberg
Søren Hauberg wrote
søn, 21 06 2009 kl. 07:18 -0700, skrev n3t:
> So I downloaded "Octave 3.2.0 for Windows MinGW Installer" from SourceForge
> and setted the include directory. If I create a project with only
> #include <octave/oct.h> and an empty main function,
> it shows to me an huge number of incredible errors! So I think I've
> downloaded a wrong file or I made a mistake about setting Visual Studio..
>
> How can explain to me what I've to do in order to achieve a good result?

I'm not a Windows user, so I'm just guessing here... The 'MinGW
Installer' is (not surprisingly) compiled with MinGW. I'm guessing that
if you want to work with MSVC you'll need to compile Octave yourself
using this compiler.
I found a thread about an old version compiled using MS Visual Studio 2008 but It was removed from sourceforge so I can't download it! :'(

Søren Hauberg wrote
If you just want to use Octave from C++ or extend
Octave with something written in C++, then why not use MinGW instead of
MSVC?
I can't do it: it's mandatory for me!
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

Søren Hauberg
søn, 21 06 2009 kl. 07:53 -0700, skrev n3t:
> I found a thread about an old version compiled using MS Visual Studio 2008
> but It was removed from sourceforge so I can't download it! :'(

No, it was removed due to license issues. But you have the Octave source
code, so you can compile it yourself with MSVC.

Søren

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
n3t
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

n3t
Ok, I've installed octave-3.0.1 compiled for visual studio 2008 (octave-3.0.1-vs2008-setup.exe), but If add the line #include <octave.h> in an working project, it says:

1>c:\programs\octave\include\octave-3.0.1\octave\octave.h(30) : error C2144: syntax error : 'int' should be preceded by ';'
1>c:\programs\octave\include\octave-3.0.1\octave\octave.h(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

how can i do? i'm desperate!
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

tmacchant
Did you setup environmental variables ?

Please see
http://www.tatsuromatsuoka.com/octave/Eng/Win/

msvcoct.html,4,606 bytes, 2009-02-25, md5 a964e274d5b4f0232363dbc8ce8a28ac, Note for mkoctfile (and
pkg install) for MSVC-octave 3.0.3.

For your case, you will perhaps use visual studio 2008 but not express edition.
I do not know there is a batch files corresponding to 'vcvarsall.bat'in the express edition.

Please see your the document how to use command line complier.

You can use compile C++ files by mkoctfile --link-stand-alone.

If you want to use Visual studio to build binaries.

You see the compiler and linker options by  

mkoctfile --link-stand-alone --verbose foo.cc

and you will find how to set compiler and linker options and you will have to reflect in the visual  
studio settings.  I do not have any experience to use visual studio so that you have to go ahead by
yourself.

Regards

Tatsuro
--- n3t wrote:

>
> Ok, I've installed octave-3.0.1 compiled for visual studio 2008
> (octave-3.0.1-vs2008-setup.exe), but If add the line #include <octave.h> in
> an working project, it says:
>
> 1>c:\programs\octave\include\octave-3.0.1\octave\octave.h(30) : error C2144:
> syntax error : 'int' should be preceded by ';'
> 1>c:\programs\octave\include\octave-3.0.1\octave\octave.h(30) : error C4430:
> missing type specifier - int assumed. Note: C++ does not support default-int
>
> how can i do? i'm desperate!
> --
> View this message in context:
> http://www.nabble.com/Getting-started-with-Octave-and-Visual-C%2B%2B-tp24134467p24163206.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


--------------------------------------
Power up the Internet with Yahoo! Toolbar.
http://pr.mail.yahoo.co.jp/toolbar/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
n3t
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

n3t
In reply to this post by n3t
Ok, I was not clear, so I will explain what I did.

1) Installed octave-3.0.1-vs2008-setup.exe [note: I've VS2008 not express, but professional edition]

2) In Tools/Options I added:
Executable files -> C:\Programs\Octave\bin
Include files -> C:\Programs\Octave\include
Include files -> C:\Programs\Octave\include\octave-3.0.1\octave
Library files -> C:\Programs\Octave\lib\octave-3.0.1

3) I copied all *.dll and *.lib files in C:\Programs\Octave and subdir in all my project dirs and subdirs

4) In my project, in stdafx.h I wrote
#include <config.h>
#include <octave.h>
#include <oct.h>

5) in my only .cxx file, I wrote
#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
            Matrix A (2,2,0);

        return 0;
}

6) Menu Project/Properties/Linker/Input,
Additional dependencies -> octave.lib octinterp.lib cruft.lib


7) Build: it says to me
1>projectname- 0 error(s), 49 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

8) when I start the executable, it crashes and shows this message:

First-chance exception at 0x7c91eae0 in projectname.exe: 0xC0000005: Access violation reading location 0x00000130.
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.
projectname.exe has triggered a breakpoint
The program '[3984] projectname.exe: Native' has exited with code 0 (0x0).


Where is the mistake?
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

Michael Goffioul
It seems the compiler bumps on OCINTER_API qualifier,
so it seems oct-dlldefs.h is not included properly, which means
config.h is not included properly (config.h does includes it). Maybe
the compiler is using another config.h that happen to be in the
include path.

What you can try is to add C:\Programs\Octave\include\octave-3.0.1
only to your include path, and to include octave headers with

#include <octave/config.h>
#include <octave/octave.h>
#include <octave/oct.h>

Michael.


On Tue, Jun 23, 2009 at 12:20 PM, n3t<[hidden email]> wrote:

>
> Ok, I was not clear, so I will explain what I did.
>
> 1) Installed octave-3.0.1-vs2008-setup.exe [note: I've VS2008 not express,
> but professional edition]
>
> 2) In Tools/Options I added:
> Executable files -> C:\Programs\Octave\bin
> Include files -> C:\Programs\Octave\include
> Include files -> C:\Programs\Octave\include\octave-3.0.1\octave
> Library files -> C:\Programs\Octave\lib\octave-3.0.1
>
> 3) I copied all *.dll and *.lib files in C:\Programs\Octave and subdir in
> all my project dirs and subdirs
>
> 4) In my project, in stdafx.h I wrote
> #include <config.h>
> #include <octave.h>
> #include <oct.h>
>
> 5) in my only .cxx file, I wrote
> #include "stdafx.h"
>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>            Matrix A (2,2,0);
>
>        return 0;
> }
>
> 6) Menu Project/Properties/Linker/Input,
> Additional dependencies -> octave.lib octinterp.lib cruft.lib
>
>
> 7) Build: it says to me
> 1>projectname- 0 error(s), 49 warning(s)
> ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
>
> 8) when I start the executable, it crashes and shows this message:
>
> First-chance exception at 0x7c91eae0 in projectname.exe: 0xC0000005: Access
> violation reading location 0x00000130.
> R6034
> An application has made an attempt to load the C runtime library
> incorrectly.
> Please contact the application's support team for more information.
> projectname.exe has triggered a breakpoint
> The program '[3984] projectname.exe: Native' has exited with code 0 (0x0).
>
>
> Where is the mistake?
> --
> View this message in context: http://www.nabble.com/Getting-started-with-Octave-and-Visual-C%2B%2B-tp24134467p24164067.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
n3t
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

n3t
In reply to this post by Michael Goffioul

Michael Goffioul-2 wrote
You can't use the octave version you downloaded with Visual Studio.
C++ ABI are not compatible. You must use MinGW.

Michael.
it's a strange situation.. I've octave-3.0.1-vs2008-setup.exe, why there is "vs2008" in the name?
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

John W. Eaton
Administrator
On 23-Jun-2009, n3t wrote:

| Michael Goffioul-2 wrote:
| >
| >
| > You can't use the octave version you downloaded with Visual Studio.
| > C++ ABI are not compatible. You must use MinGW.
| >
| > Michael.
| >
|
| it's a strange situation.. I've octave-3.0.1-vs2008-setup.exe, why there is
| "vs2008" in the name? >-(

I think Michael assumed that you were using the latest version, 3.2.0,
which is compiled with MinGW.

jwe
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
n3t
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

n3t

John W. Eaton-3 wrote
I think Michael assumed that you were using the latest version, 3.2.0,
which is compiled with MinGW.
ah ok.. but there is a guide to use octave with visual studio? I'm trying actions without any hint!!
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with Octave and Visual C++

Michael Goffioul
In reply to this post by n3t
Sorry, I missed the last part of your mail.

The version you're using should be usable from VS2008,
however you must make sure to have the /MD compile flag
enabled. It's somewhere in the project settings, about the
runtime to use: /MD means you will use the runtime DLL's.

Michael.


On Tue, Jun 23, 2009 at 12:20 PM, n3t<[hidden email]> wrote:

>
> Ok, I was not clear, so I will explain what I did.
>
> 1) Installed octave-3.0.1-vs2008-setup.exe [note: I've VS2008 not express,
> but professional edition]
>
> 2) In Tools/Options I added:
> Executable files -> C:\Programs\Octave\bin
> Include files -> C:\Programs\Octave\include
> Include files -> C:\Programs\Octave\include\octave-3.0.1\octave
> Library files -> C:\Programs\Octave\lib\octave-3.0.1
>
> 3) I copied all *.dll and *.lib files in C:\Programs\Octave and subdir in
> all my project dirs and subdirs
>
> 4) In my project, in stdafx.h I wrote
> #include <config.h>
> #include <octave.h>
> #include <oct.h>
>
> 5) in my only .cxx file, I wrote
> #include "stdafx.h"
>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>            Matrix A (2,2,0);
>
>        return 0;
> }
>
> 6) Menu Project/Properties/Linker/Input,
> Additional dependencies -> octave.lib octinterp.lib cruft.lib
>
>
> 7) Build: it says to me
> 1>projectname- 0 error(s), 49 warning(s)
> ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
>
> 8) when I start the executable, it crashes and shows this message:
>
> First-chance exception at 0x7c91eae0 in projectname.exe: 0xC0000005: Access
> violation reading location 0x00000130.
> R6034
> An application has made an attempt to load the C runtime library
> incorrectly.
> Please contact the application's support team for more information.
> projectname.exe has triggered a breakpoint
> The program '[3984] projectname.exe: Native' has exited with code 0 (0x0).
>
>
> Where is the mistake?
> --
> View this message in context: http://www.nabble.com/Getting-started-with-Octave-and-Visual-C%2B%2B-tp24134467p24164067.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave