I have a simple C++ script titled “helloworld.cpp”:
#include "arrayfire.h"
#include <stdio.h>
using namespace std;
using namespace af;
int main(void)
{
af::array a = af::randu(10000);
return 0;
}
For brevity, my .sublime-build
is included below. I am using ST3 as my C++ editor and compiler. When I try to use ArrayFire to create a simple aray of random numbers, I am getting a couple weird errors:
C:\WINDOWS\TEMP\ccSsW23x.o:helloworld.cpp:(.text+0x27): undefined reference to `_imp___ZN2af5randuEi8af_dtype'
C:\WINDOWS\TEMP\ccSsW23x.o:helloworld.cpp:(.text+0x39): undefined reference to `_imp___ZN2af5arrayD1Ev'
collect2.exe: error: ld returned 1 exit status
A Google search returns nothing on the weird imp
errors, and I believe I have included all correct folders, and properly defined my library folder. Any clues as to what is going on? Or suggestions on how to solve it?
My .sublime-build
file is as follows:
{
"cmd": ["g++", "-Wall", "-Wextra", "-std=c99", "${file}", "-o", "${file_path}/${file_base_name}", "-I", "C:/Program Files/ArrayFire/v3/include", "-I", "C:/Program Files/ArrayFire/v3/include/af"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ \"-Wall\" \"${file}\" -o \"${file_path}/${file_base_name}\" -I \"C:/Program Files/ArrayFire/v3/include\" -I \"C:/Program Files/ArrayFire/v3/include/af\" -I \"C:/Program Files/ArrayFire/v3/include/fg\" -I \"C:/package/armadillo74002/include\" -L \"C:/Program Files/ArrayFire/v3/lib\""
}
]
}