help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to use fft in c++


From: Pantxo
Subject: Re: how to use fft in c++
Date: Fri, 9 Jun 2017 09:15:25 -0700 (PDT)

Le 09/06/2017 à 17:28, Progressive [via Octave] a écrit :
>
>
> Well, at first thank you very much!
>
>
> I'm trying to implement to that and since it doesn't work I stick to a 
> basic try:
>
>
>                 DEFUN_DLD (helloworld, args, nargout,"Hello World Help 
> String")
>
>                 {
>
>
>                 }
>
>
> from 
> https://www.gnu.org/software/octave/doc/v4.0.1/Getting-Started-with-Oct_002dFiles.html
>  already 
> doesn't work. I receive the following:
>
>
> address@hidden:~/analysis/analyse_tree/Filter$ make clean && make
>
> rm -f filter *.o
>
> g++ -c -I/usr/include/octave-4.0.2/octave -g -Wall `root-config 
> --cflags --libs` -fPIC -O3 -pthread -std=c++11 
> -Wno-deprecated-declarations -m64 -I/home/user/root/include Filter.cpp 
> -o Filter.o -I/home/user/analysis/analyse_tree/Filter
>
> In file included from /usr/include/octave-4.0.2/octave/defun-dld.h:30:0,
>
>                  from /usr/include/octave-4.0.2/octave/oct.h:36,
>
>                  from Filter.cpp:5:
>
> Filter.cpp: In function ‘int main()’:
>
> /usr/include/octave-4.0.2/octave/defun-int.h:101:10: error: expected 
> unqualified-id before string constant
>
>    extern "C" \
>
>           ^
>
> /usr/include/octave-4.0.2/octave/defun-int.h:98:3: note: in expansion 
> of macro ‘DEFINE_FUNX_INSTALLER_FUN’
>
>    DEFINE_FUNX_INSTALLER_FUN(#name, F ## name, G ## name, doc)
>
>    ^
>
> /usr/include/octave-4.0.2/octave/defun-dld.h:61:3: note: in expansion 
> of macro ‘DEFINE_FUN_INSTALLER_FUN’
>
>    DEFINE_FUN_INSTALLER_FUN (name, doc) \
>
>    ^
>
> Filter.cpp:303:3: note: in expansion of macro ‘DEFUN_DLD’
>
>    DEFUN_DLD (helloworld, FADC2_ev18_crystal_12, nargout,"Hello World 
> Help String")
>
>    ^
>
> Filter.cpp:444:1: error: expected ‘}’ at end of input
>
>  }
>
>  ^
>
> Filter.cpp:257:9: warning: unused variable ‘Outputfile_filtered’ 
> [-Wunused-variable]
>
>   TFile *Outputfile_filtered=new TFile(outputfile_filter, "RECREATE"); 
>          // Outputfile
>
>          ^
>
> Filter.cpp:444:1: error: expected ‘}’ at end of input
>
>  }
>
>
> Without DEFUN_DLD it works. The description says that the first 
> argument of DEFUN_DLD has to be name of the function within octave. 
> But as it is an example it should work though (despite it does not 
> work, too, by changin helloworld to fft).
>
>
> What am I doing wrongly?
>
> Thank you in advance!
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> If you reply to this email, your message will be added to the 
> discussion below:
>
> http://octave.1599824.n4.nabble.com/how-to-use-fft-in-c-tp4683590p4683621.html
>
>
>
> To unsubscribe from how to use fft in c++, click here 
> <http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4683590&code=cGFudHhvLmRpcmliYXJuZUBnbWFpbC5jb218NDY4MzU5MHwtNTYyMDk1Nzc5>.
>
> NAML 
> <http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
First the DEFUN_DLD is a macro that is useful only if you want the 
Octave interpreter to be able to find and use your function. In your 
case this doesn't look useful: Octave functions from a C++ program.

The only thing you need in your program is to include 
<octave/builtin-defun-decls.h>, then any builtin function such as "fft" 
should be accessible by appending a capital "F". In fact there is a 
perfect example: see examples/code/standalonebuitlin.cc and compile it 
using the mkoctfile utility

mkoctfile --link-stand-alone -o tst ./standalonebuiltin.cc

Pantxo







--
View this message in context: 
http://octave.1599824.n4.nabble.com/how-to-use-fft-in-c-tp4683590p4683622.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]