help-octave
[Top][All Lists]
Advanced

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

Re: New User and how to use octave in c code ?


From: Progressive
Subject: Re: New User and how to use octave in c code ?
Date: Wed, 26 Apr 2017 10:43:00 -0700 (PDT)

> We can start there. You should be able to build the example standalone
> program provided with the Octave source.
>
>    $ curl -sO
> https://hg.savannah.gnu.org/hgweb/octave/raw-file/tip/examples/code/standalone.cc
>  
>    $ mkoctfile --link-stand-alone standalone.cc -o standalone
>    $ ./standalone
>    Hello Octave world!
>     11 12
>     21 22 

Thanks! That worked fine. Now I also know that mkoctile is the makefile
itself. I thought I have to enter this line in my existing Makefile. 
But is this possible ? Because I need Cern ROOT. I feel free by posting my
Makefile in advance:

CXX = g++
CXXFLAGS = -g -Wall `root-config --cflags --libs` -fPIC -O3

LD = g++
LDFLAGS = -g

SOURCES=$(wildcard *.cpp)
OBJECTS=$(SOURCES:.cpp=.o)
HEADERS=$(SOURCES:.cpp=.h)
EXECUTABLE=test_octave

CXXFLAGS += $(shell root-config --cflags)
LIBS = $(shell root-config --libs)
NGLIBS = $(shell root-config --glibs)
GLIBS = $(filter-out -lNew, $(NGLIBS))


.SUFFIXES: .cpp

# ==========================================
all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
        $(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(LIBS) 

.cpp.o: $(SOURCES) $(HEADERS)
        $(CXX) -c $(CXXFLAGS) $< -o $@ -I$(PWD) 

clean:
        rm -f $(EXECUTABLE) *.o 



That's a good question. I have a .cpp file (Filter.cxx) written to use Cern
ROOT: (attached) Filter.cxx
<http://octave.1599824.n4.nabble.com/file/n4683049/Filter.cxx>   to analyze
data (Filter_trace_array.root) which is generated by another macro. The data
is stored as a root file:  Filter_traces_array.root
<http://octave.1599824.n4.nabble.com/file/n4683049/Filter_traces_array.root> 
. 
In Filter.cxx I would like to implement octave. At the moment I only tried
to compile it successfully by including the octave header. But after a lot
of try and error I'm convinced that this is not possible?



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



reply via email to

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