VC++ Directories (Include and Source) in VS2012

Hi,

Today I finally got my Uno recognized In Visual Studio the use of lower case IDEin Visual Macro and my combined ADHD/scanning rather than reading fully saw this as ‘idle’ and figured it was an arbitrary folder for generated files. Idiot!

Next up today this is my first C++ project in something like 8 to 10 years. I took the easy life and became a C# developer.

I worked as C/ C++ developer the rest of my career and got into the habit of doing things my way, just as we all do. One of those is setting up the VC++ directories for common libraries, source and include files etc. I’m trying to do this for the SmartThings source and header files so I can more of less forget about them.

Its not working though and I’ve never run into this before. I can’t screen capture the menu as it disappears each time I do.anyway VS2012 -> Solution Explorer -> Select Project File -> Alt + Enter. Expand Configuration Properties and select VC++ Directories. I’ve added the following at the end to both Include Files and Source Files:

$(HOMEDRIVE)$(HOMEPATH)\Documents\Arduino\libraries\SmartThings

Now #include <SmartThings.h> no longer has the reg squiggles beneath the include keyword so I’m doing something right at least and I on the text SmartThings.h, I right-click and choose Open Document <SmartThings.h> and it works just fine :smile:

Has anybody else taken this approach and got it working?

(PS This post took over an hour to write because I have a splint protecting the whole of left my hand and its fingers. Don’t do stupid things like slice your hand open, requiring multiple operations to fix, if you’re a dev. One handed typing is a killer and try hitting right alt + 3 to get a hash when RDPing to your dev machine from an 11" MacBook Air, that was awkward and painful!!!)

Thanks,
Lee

I use Atmel Studio (a free version of Visual Studio that only compiles for Atmel chips like Arduino).

I have some sort of plug-in for it that can help debugging, but I forget if essential.

Maybe it creates the correct library path and options for the build / compile command?

Anyway, I am able to manage multiple libraries, paths, compile targets, etc, and upload directly from the IDE to the Arduino etc., all from this special tailored Visual Studio environment.

I can try to figure out if my preferences / settings are sharable to you… But in the meantime, perhaps Google “Atmel Studio” as it might be quickest way to success to just use their config?

Thanks for that mate Big improvements but stil no ball:

Compiling ‘Recliner2’ for 'Arduino/Genuino Uno’
Build folder: file:///C:/Users/Lee/AppData/Local/V.Micro/Arduino/Builds/Recliner2/uno
Summary: Header=1 Prototypes=3 Imports=2
Additional Defines:
Architecture Tools: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/
Sketchbook: file:///C:/Users/Lee/Documents/Arduino/libraries/SmartThings
Core Include Paths
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino’
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard’
Library Include Paths (1)
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial’
Platform Libraries Root Include Paths
Include Path 'C:\Program Files (x86)\Arduino\libraries’
Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries’
Include Path 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\unqlgtb4.1ye\Micro Platforms\default\debuggers’
Include Path ‘C:\Users\Lee\Documents\Arduino\libraries\SmartThings\libraries’
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=165 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial" -I"C:\Program Files (x86)\Arduino\libraries" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries" -I"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\unqlgtb4.1ye\Micro Platforms\default\debuggers" -I"C:\Users\Lee\Documents\Arduino\libraries\SmartThings\libraries" “C:\Users\Lee\AppData\Local\V.Micro\Arduino\Builds\Recliner2\uno\Recliner2.cpp” -o "C:\Users\Lee\AppData\Local\V.Micro\Arduino\Builds\Recliner2\uno\Recliner2.cpp.o"
Recliner2.ino:2:25: fatal error: SmartThings.h: No such file or directory
Error compiling

If I right-click on SmartThings.h in the include (<> style not “”) it opens.

Not the smooth experiemce this product needs, for me anyway. Why oh why didn’t you do it start to finish in .NET. Xamarin managed it.

Double quotes vs. <> matters.

I’ve successfully built a couple complex projects using a dozen libraries, in Atmel Studio. Unfortunately that was late last year, so it would take me some spinup time to figure out what specific config files and paths are picky and if it’s obvious or takes digging.

The SmartThings library is extremely trivial, so this is not an ST problem… It just a matter of configuring your Atmel build environment settings and/or pre-compiling the SmartThings source in Atmel to be sure to have linkable object, or ?

At some point I can dig through my configs… I guess.

Yep get the <> vs “”" thing. If I leave the header fie in a known to VS path or if I include in the app I get the same… Its only been a few hours each day but its enough to put me off developing for this platform. How would a complete development but electronics wizard find their way around this???

What “platform” are you referring to?

  • SmartThings
  • Atmel
  • Arduino
  • VisualStudio ?

If you’re just having Arduino compile problems, then use the Arduino IDE… It’s designed for “dummies”</strike)> “anyone”.

1 Like

I’m referring to Adruino right now as the same happens in there. SmartThings is installed correctly (??) as a library.

I’m a strong advocate for them having done this as a .NET framework rather than develop Groovy from Java. They (SmartThings) could have written a far more powerful, concise and extensible API in ,NET. Full nuget support for board and library support, IoC, visualstudio.com integration out of the box etc etc.

A brand new Sketch with SmartThings library added (in Adruino) IDE:

#include <SmartThings.h>

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}:

The use of the word dummy is fine with me at the moment. Perhaps that is what is frustrating me most. I feel like one.

Error message from Adruino IDE is:

Arduino: 1.6.5 (Windows 8.1), Board: “Arduino/Genuino Uno”

In file included from sketch_sep13b.ino:1:0:
C:\Users\Lee\Documents\Projects\Labs\Arduino\Sketchbooks\libraries\SmartThings/SmartThings.h:30:28: fatal error: SoftwareSerial.h: No such file or directory
#include <SoftwareSerial.h>
^
compilation terminated.
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Oh just read it in full!!! Added that so back into SmartThings world, Its not discoverable so I’ll have a re-read.

The SmartThings.h and .cpp, etc., have to be in the same Sketchbook (folder) as the Sketch you are compiling, OR as an imported library to the standard Arduino library path.

I believe that the “standard Arduino library path” is:

sketchbook.path (from your preferences.txt file)\libraries\<library_name>

There is a “foolproof” :wink: menu option in the Arduino IDE to import a Library that was in ZIP format.
Once imported SmartThings should be shown in the lower portion under “Contributed libraries”.


But I also recommend:
Add “SoftwareSerial.h” to your main program above the SmartThings.h

#include <SoftwareSerial.h>   //TODO need to set due to some weird wire language linker, should we absorb this whole library into smartthings
#include <SmartThings.h>

#define PIN_THING_RX    3
#define PIN_THING_TX    2

SmartThingsCallout_t messageCallout;    // call out function forward decalaration
SmartThings smartthing(PIN_THING_RX, PIN_THING_TX, messageCallout, "", false);  // constructor