I am trying to access the Tracker::instance()
(to use the location object)
but got an error the moment i added #include "tracker.h"
to my own header file.
> Executing task in folder sts-tracker-firmware: make -f '/Users/kennethlimcp/.particle/toolchains/buildscripts/1.9.2/Makefile' compile-user -s <
:::: COMPILING APPLICATION
Creating /path/target/1.5.4-rc.1/tracker/platform_user_ram.ld ...
In file included from /path/lib/config-service/src/config_service.h:21:0,
from /path//src/tracker.h:25,
from /path//src/r.h:9,
from /path//src/r.cpp:1:
/path/lib/config-service/src/config_service_nodes.h:148:37: error: macro "max" requires 2 arguments, but only 1 given
ConfigInt &max(int32_t value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:149:37: error: macro "min" requires 2 arguments, but only 1 given
ConfigInt &min(int32_t value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:183:38: error: macro "max" requires 2 arguments, but only 1 given
ConfigFloat &max(double value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:184:38: error: macro "min" requires 2 arguments, but only 1 given
ConfigFloat &min(double value) {range_min = value; return *this;}
^
In file included from ./inc/Arduino.h:27:0,
from /path/lib/MCP_CAN_RK/src/mcp_can_dfs.h:27,
from /path/lib/MCP_CAN_RK/src/mcp_can.h:27,
from /path//src/r.h:6,
from /path//src/r.cpp:1:
/Users/kennethlimcp/.particle/toolchains/gcc-arm/5.3.1/arm-none-eabi/include/c++/5.3.1/bits/stl_vector.h: In member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_M_check_len(std::vector<_Tp, _Alloc>::size_type, const char*) const':
../wiring/inc/spark_wiring_arduino_constants.h:111:18: error: expected unqualified-id before '(' token
#define max(a,b) ((a)>(b)?(a):(b))
^
/Users/kennethlimcp/.particle/toolchains/gcc-arm/5.3.1/arm-none-eabi/include/c++/5.3.1/bits/stl_bvector.h: In member function 'std::vector<bool, _Alloc>::size_type std::vector<bool, _Alloc>::_M_check_len(std::vector<bool, _Alloc>::size_type, const char*) cons':
../wiring/inc/spark_wiring_arduino_constants.h:111:18: error: expected unqualified-id before '(' token
#define max(a,b) ((a)>(b)?(a):(b))
^
In file included from /path/lib/config-service/src/config_service.h:21:0,
from /path//src/tracker.h:25,
from /path//src/r.h:9,
from /path//src/r.cpp:1:
/path/lib/config-service/src/config_service_nodes.h: At global scope:
/path/lib/config-service/src/config_service_nodes.h:148:72: error: expected ';' at end of member declaration
ConfigInt &max(int32_t value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:149:72: error: expected ';' at end of member declaration
ConfigInt &min(int32_t value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:148:52: error: 'value' was not declared in this scope
ConfigInt &max(int32_t value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:148:57: error: expected '}' before ';' token
ConfigInt &max(int32_t value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:148:57: error: invalid initialization of non-const reference of type 'ConfigInt&' from an rvalue of type '<brace-enclosed initializer list>'
/path/lib/config-service/src/config_service_nodes.h:148:57: error: expected ';' before ';' token
/path/lib/config-service/src/config_service_nodes.h:149:52: error: 'value' was not declared in this scope
ConfigInt &min(int32_t value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:149:57: error: expected '}' before ';' token
ConfigInt &min(int32_t value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:149:57: error: invalid initialization of non-const reference of type 'ConfigInt&' from an rvalue of type '<brace-enclosed initializer list>'
/path/lib/config-service/src/config_service_nodes.h:149:57: error: expected ';' before ';' token
/path/lib/config-service/src/config_service_nodes.h:183:73: error: expected ';' at end of member declaration
ConfigFloat &max(double value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:184:73: error: expected ';' at end of member declaration
ConfigFloat &min(double value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:183:53: error: 'value' was not declared in this scope
ConfigFloat &max(double value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:183:58: error: expected '}' before ';' token
ConfigFloat &max(double value) {range_max = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:183:58: error: invalid initialization of non-const reference of type 'ConfigFloat&' from an rvalue of type '<brace-enclosed initializer list>'
/path/lib/config-service/src/config_service_nodes.h:183:58: error: expected ';' before ';' token
/patg/lib/config-service/src/config_service_nodes.h:184:53: error: 'value' was not declared in this scope
ConfigFloat &min(double value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:184:58: error: expected '}' before ';' token
ConfigFloat &min(double value) {range_min = value; return *this;}
^
/path/lib/config-service/src/config_service_nodes.h:184:58: error: invalid initialization of non-const reference of type 'ConfigFloat&' from an rvalue of type '<brace-enclosed initializer list>'
/path/lib/config-service/src/config_service_nodes.h:184:58: error: expected ';' before ';' token
make[3]: *** [../build/target/user/platform-26-m/firmware/src/r.o] Error 1
make[2]: *** [user] Error 2
make[1]: *** [modules/tracker/user-part] Error 2
make: *** [compile-user] Error 2
The terminal process "/bin/bash '-c', 'make -f '/Users/kennethlimcp/.particle/toolchains/buildscripts/1.9.2/Makefile' compile-user -s'" terminated with exit code: 2.
Press any key to close the terminal.
Any idea why? Adding #include "tracker.h" to
main.cpp` works fineβ¦
Removing the #include tracker.h
in my header file allows the firmware to compile without issues.