Using Octave in C++ -


i new in both octave , c++ ! want use octave in c++ , found webpage. started upper code , tried run it. unfortunately there no document on matter , encountered lot of errors. first used msvc 2010 , found should use gcc!! here i'v done far:

  1. download octave link, (i download octave-4.0.0_0.zip)
  2. i tried compile code:

    int main (void) {   std::cout << "hello octave world!\n";    int n = 2;   matrix a_matrix = matrix (n, n);    (octave_idx_type = 0; < n; i++)     (octave_idx_type j = 0; j < n; j++)       a_matrix(i,j) = (i + 1) * 10 + (j + 1);    std::cout << a_matrix;    return 0; } 

i included: 1) iostream , 2) octave directory: n:\octave-4.0.0\include\octave-4.0.0\octave\oct.h

i got error in msvc10: 1>n:\octave-4.0.0\include\math.h(169): error c2065: 'asm' : undeclared identifier 1>n:\octave-4.0.0\include\math.h(169): error c2146: syntax error : missing ';' before identifier 'volatile' 1>n:\octave-4.0.0\include\math.h(169): error c2143: syntax error : missing ')' before ':' 1>n:\octave-4.0.0\include\math.h(169): error c2059: syntax error : ')'

and error in codeblocks using gcc:

c:/users/sam/documents/codeblock_c++/testoctave/main.cpp:19: undefined reference operator<<(std::ostream&, matrix const&)' obj\debug\main.o: in functionzn10dim_vector11make_uniqueev': n:/octave-4.0.0/include/octave-4.0.0/octave/dim-vector.h:134: undefined reference __sync_add_and_fetch_4' obj\debug\main.o: in functionzn10dim_vectord1ev': n:/octave-4.0.0/include/octave-4.0.0/octave/dim-vector.h:286: undefined reference __sync_add_and_fetch_4' obj\debug\main.o: in functionzn15octave_refcountiiemmev': n:/octave-4.0.0/include/octave-4.0.0/octave/oct-refcount.h:72: undefined reference __sync_add_and_fetch_4' obj\debug\main.o: in functionzn5arrayidec2erk10dim_vector': n:/octave-4.0.0/include/octave-4.0.0/octave/array.h:184: undefined reference dim_vector::safe_numel() const' obj\debug\main.o:main.cpp:(.rdata$_ztv6matrix[__ztv6matrix]+0x10): undefined reference toarray::resize_fill_value() const' obj\debug\main.o:main.cpp:(.rdata$_ztv7ndarray[__ztv7ndarray]+0x10): undefined reference array<double>::resize_fill_value() const' obj\debug\main.o:main.cpp:(.rdata$_ztv6marrayide[__ztv6marrayide]+0x10): undefined reference toarray::resize_fill_value() const' obj\debug\main.o:main.cpp:(.rdata$_ztv5arrayide[__ztv5arrayide]+0x10): undefined reference `array::resize_fill_value() const' collect2.exe: error: ld returned 1 exit status process terminated status 1 (0 minute(s), 1 second(s))

i appreciate help!


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -