Sublime Forum

Using SublimeText3 for C++ programming -- trouble pointing to header file using build-system file

#1

I am using Sublime Text 3 as a compiler for my C++ scripts, but I cannot understand why the pointer indicated in the .sublime-build file.

Specifically, I am trying to use the armadillo package for c++. After downloading the tar.xz file, I copied the files to: C:\package\armadillo74002\include. However, when I run the very simple script:

#include <armadillo>

I am getting an error: fatal error: armadillo: No such file or directory.

My .sublime-build file is as follows:

{
"cmd": ["g++", "$file_name", "-o", 
"${file_base_name}.exe", "-I C:/package/armadillo74002/include/", 
"&&", "start", "cmd", "/c" , "$file_base_name"],
"selector": "source.c",
"working_dir": "${file_path}",
"shell": true
}

I am wondering if the syntax of pointing to the folder is incorrect
("-I", where “I” is a capital " i "), or if I am missing something
bigger?

0 Likes

#2

try
"-I", "C:/package/armadillo74002/include/"
rather than
"-I C:/package/armadillo74002/include/"

0 Likes

#3

Thank you for the reply – I used your suggestion, but I actually found the “fix” on StackOverflow. It turns out that the fix I was looking for was based on the syntax that I was calling the header file. Long story short, I was using < > and needed to use " ". The suggestion can be found here.

1 Like