Differences between building with webIDE and spark-cli

I am building the IDDHT22 example code, this works fine on the web IDE.

Copying all files to a folder on my desktop PC and creating an idDHT22 subfolder for the library files fails.
I also created a spark.include listing all the files

    spark compile
Including:
    /src/spark/temperature/idDHT22.cpp
    /src/spark/temperature/idDHT22.h
    /src/spark/temperature/temperature.ino
attempting to compile firmware 
pushing file: /src/spark/temperature/idDHT22.cpp
pushing file: /src/spark/temperature/idDHT22.h
pushing file: /src/spark/temperature/temperature.ino
Errors
In file included from ../inc/spark_wiring.h:29:0,
                 from ../inc/application.h:29,
                 from idDHT22.h:19,
                 from idDHT22.cpp:19:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
 #warning  "Defaulting to Release Build"
  ^
In file included from ../inc/spark_wiring.h:29:0,
                 from ../inc/application.h:29,
                 from temperature.cpp:2:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
 #warning  "Defaulting to Release Build"
  ^
temperature.cpp:4:29: fatal error: idDHT22/idDHT22.h: No such file or directory
 void read_sensor();
                             ^
compilation terminated.
make: *** [temperature.o] Error 1

Moving the library files up a level and changing the #include to #include “idDHT22.h” then works.

Copying the file back to the webIDE now fails as it hold the library files in a sub-folder.

I would like the command line version to work as expected, that is pull in the idDHT22/* files and not complain when it trys to build them about internal issues which should just resolve.

Finally I did try to change the “application.h” and “math.h” entries to <application.h> and <math.h> in the idDHT22.h file but this made no difference either.

Any suggestions?

Many thanks
kevin

@kevin,

you can do that by upgrading Spark-cli to the latest version and add a spark.include file with the following:

#spark.include 
# from current dir
*.h
*.ino
*.cpp
*.c

# and from any subdirectories
**/*.h
**/*.ino
**/*.cpp
**/*.c

With this, your library files will now be able to reside in the idDHT22 folder :wink:

Thanks Kenneth,

Unfortunately all is still not well, I am on the latest version of spark-cli (I only installed it today), now I am told the header file does not exist, even though it does!

 spark compile
Including:
    /src/spark/temperature/temperature.ino
    /src/spark/temperature/idDHT22/idDHT22.h
    /src/spark/temperature/idDHT22/idDHT22.cpp
attempting to compile firmware 
pushing file: /src/spark/temperature/temperature.ino
pushing file: /src/spark/temperature/idDHT22/idDHT22.h
pushing file: /src/spark/temperature/idDHT22/idDHT22.cpp
Errors
In file included from ../inc/spark_wiring.h:29:0,
                 from ../inc/application.h:29,
                 from idDHT22.h:19,
                 from idDHT22.cpp:19:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
 #warning  "Defaulting to Release Build"
  ^
In file included from ../inc/spark_wiring.h:29:0,
                 from ../inc/application.h:29,
                 from temperature.cpp:2:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
 #warning  "Defaulting to Release Build"
  ^
temperature.cpp:9:33: fatal error: idDHT22/idDHT22.h: No such file or directory
 // lets start with some defines to keep the code clean
                                 ^
compilation terminated.
make: *** [temperature.o] Error 1

Compile failed -  compile failed 

I have added a #define style work around the header files for now, so things work well enough for now.

#define REMOTE 1

#ifdef REMOTE
    #include "idDHT22/idDHT22.h"
#else
    #include "idDHT22.h"
#endif

cheers
kevin