Dev Compiles but CLI doesn't

I’m refactoring some code from a flat directory to a tiered structure…

I came across what is likely some kind of bug in that my project will compile a binary in Dev, but I get linking errors in the CLI mainly related to the location of library files (which I expect). This was frustrating because I could flash my device but…

The compiled binary isn’t produced with a recognizable header that will allow its upload into the Products firmware bucket. This may have something to do with the linking error, but I wanted to introduce the idea that somehow, I am getting a compiled unit that won’t compile if I use the CLI build tool and the header information for a Product isn’t valid.

I thought they were the same compiler!

#pragma SPARK_NO_PREPROCESSOR
#define makeString(s) str(s)
#define str(s) #s
#define PARTICLE_PRODUCT_ID 1234
#define PARTICLE_PRODUCT_VERSION 1
#define CUSTOMER_URL somecustomerurl.com

#include "Particle.h"

PRODUCT_ID(PARTICLE_PRODUCT_ID);
PRODUCT_VERSION(PARTICLE_PRODUCT_VERSION);

/******************************************************************************/
/************************** SOFT AP CODE STARTS HERE **************************/
/******************************************************************************/

The macros work… I verified before I reorganized my file structure.

What command are you using for CLI build?
Although superfluous knowing your experience, I still ask what CLI version? :blush:

Version: 1.21.0

this instruction to compile using the command line: particle compile photon

Can you post the errors and a overview of your file hierarchy?

Also make sure your tree does not contain any files that reeimplement setup() and/or loop().
Copying external libraries also copies the supplied samples which will break your build - but that would hit Dev and CLI just the same :confused:

You may also try particle compile photon . --target 0.6.0 (the dot . is intentionally to refer to the current directory - provided you are running CLI from the location where the project.properties file lives)

I'm not using the Particle hierarchy, so that may be part of my problem wth the linking errors, which I understand.

I cannot post my errors un-redacted so give me some time to get back to you.