Compiler fails with particle-cli, but works in build.particle.com

Hi,
I’m having issues compiling a folder locally using particle cli.

The same code compiles perfectly on build.particle.com

Source code: https://github.com/mcaprari/Contorto/tree/master/remote_unit

Error details:

caprazzo:Contorto/ (master✗) $ particle compile photon remote_unit                                                                  [9:54:00]

Compiling code for photon

Including:
    /Users/caprazzo/Documents/Projects/Contorto/remote_unit/pump.h
    /Users/caprazzo/Documents/Projects/Contorto/remote_unit/water_level.h
    /Users/caprazzo/Documents/Projects/Contorto/remote_unit/contorto_remote_unit.ino
    /Users/caprazzo/Documents/Projects/Contorto/remote_unit/pump.cpp
    /Users/caprazzo/Documents/Projects/Contorto/remote_unit/water_level.cpp
attempting to compile firmware
pushing file: /Users/caprazzo/Documents/Projects/Contorto/remote_unit/pump.h
pushing file: /Users/caprazzo/Documents/Projects/Contorto/remote_unit/water_level.h
pushing file: /Users/caprazzo/Documents/Projects/Contorto/remote_unit/contorto_remote_unit.ino
pushing file: /Users/caprazzo/Documents/Projects/Contorto/remote_unit/pump.cpp
pushing file: /Users/caprazzo/Documents/Projects/Contorto/remote_unit/water_level.cpp
Errors
../../../build/target/user/platform-6/libuser.a(contorto_remote_unit.o): In function `onCommandFill(char const*, char const*)':
contorto_remote_unit.cpp:23: undefined reference to `Pump::set_max_time(long)'
contorto_remote_unit.cpp:24: undefined reference to `WaterLevel::record_dry()'
contorto_remote_unit.cpp:26: undefined reference to `Pump::start()'
../../../build/target/user/platform-6/libuser.a(contorto_remote_unit.o): In function `loop':
contorto_remote_unit.cpp:44: undefined reference to `Pump::is_started()'
contorto_remote_unit.cpp:45: undefined reference to `WaterLevel::is_wet()'
contorto_remote_unit.cpp:46: undefined reference to `Pump::stop()'
contorto_remote_unit.cpp:49: undefined reference to `Pump::is_overtime()'
contorto_remote_unit.cpp:50: undefined reference to `Pump::stop()'
../../../build/target/user/platform-6/libuser.a(contorto_remote_unit.o): In function `__static_initialization_and_destruction_0':
contorto_remote_unit.cpp:16: undefined reference to `WaterLevel::WaterLevel(int, int)'
contorto_remote_unit.cpp:17: undefined reference to `Pump::Pump(int)'
collect2: error: ld returned 1 exit status
make: *** [5a5a2ef13b5afa0edb26871b4b49e4f427ed5b843173b506dde682faff0c.elf] Error 1

Compile failed. Exiting.

I can’t see any implementations for your functions.

The github link you provided only contains empty CPPs.

Thanks ScruffR,
You are absolutely right.

I was editing code from the wrong location… late night programming.

Apologies.

Thanks,
-teo

1 Like