Hi everyone,
I am trying to implement a direction finding technique on an xmos board using root-MUSIC. I implemented root-MUSIC using the Eigen project. When I try to build a cpp file including the root-MUSIC header file, everything works fine. But when I include the same header file in my xc file and try to build the xc file, I get errors such as:
../src/root_music.h:15:10: fatal error: 'vector' file not found
../src/root_music.h:19:7: error: parse error before "namespace"
using namespace Eigen;
../src/root_music.h:23:11: error: parse error before ':' token
static std::vector<double> root_music(std::complex<double> *signals, int const nsamples, int const nsensors, double k_f, double d)
../src/root_music.h:37:35: error: parse error before '++' token
for(int i = 0; i< n_sensors; i++) {
I have tried finding a solution to this problem in this forum but nothing has resolved my issue, yet. I am using xTIMEcomposer: Community_14.2.3 (build 15642, Oct-17-2016) on Mac OS X Sierra.
Thank you for your help!
xc file not building with cpp headers
-
- Member++
- Posts: 27
- Joined: Tue Feb 28, 2017 12:52 pm
-
- XCore Addict
- Posts: 169
- Joined: Fri Oct 23, 2015 10:23 am
Hi,
I am not familiar with your particular situation, but in general C, C++, and XC are different languages with some overlap.
There is a subset (e.g. basic types and function definitions) that all languages understand and agree upon.
XC will certainly get upset with C++ template and namespace syntax - as in your example.
I am not familiar with your particular situation, but in general C, C++, and XC are different languages with some overlap.
There is a subset (e.g. basic types and function definitions) that all languages understand and agree upon.
XC will certainly get upset with C++ template and namespace syntax - as in your example.
-
- Member++
- Posts: 27
- Joined: Tue Feb 28, 2017 12:52 pm
Hi Robert,
Can you not refer me to some document or give me any other resource that might help me find the solution?
Thank you!
Can you not refer me to some document or give me any other resource that might help me find the solution?
Thank you!
-
- XCore Addict
- Posts: 169
- Joined: Fri Oct 23, 2015 10:23 am
XC files can't directly include or call the C++ code in your header file.
You need to include the c++ header in a cpp file and write C++ code to access the root_music stuff.
This C++ file can then make available 'simple function calls' that can be called by XC files.
These 'simple function calls' will conform to the xcore ABI.
For more info search 'xmos abi'
You need to include the c++ header in a cpp file and write C++ code to access the root_music stuff.
This C++ file can then make available 'simple function calls' that can be called by XC files.
These 'simple function calls' will conform to the xcore ABI.
For more info search 'xmos abi'
-
- Member++
- Posts: 27
- Joined: Tue Feb 28, 2017 12:52 pm
Thank you Robert, I will dig into it and give some feedback if I can make it work.