Cannot build sample code - Unable to open header files

I’m trying to use some sample code to try out the Lynx light sensing module. I don’t recall exactly when and, at the moment, I can’t find the source file but I downloaded a bunch of samples in a file called I’m trying to compile the LightSense.sln (Main.cpp included for reference)

When I try to build the solution, I get a series of errors. The error is “IntelliSense: cannot open source file 'Gadgeteering.h”. I have one error for each .h file. These are errors, not warnings.

When I right-click on on the include statements and select Open Document, the IDE has no problem opening the .h files. To get this far, I copied all the header files from the GHI folder in Program Files into my solution folder; probably not the best solution but I’m a C# guy with some experience in C++ so I’m trying.

How do I fix the above errors so I can build this solution? Do I need to reference a .lib file? If so, how do I do that? Visual Studio 2013, Windows 8.1…


 #include <iostream>

 #include <Gadgeteering.h>

 #include <Mainboards/FEZLynxS4.h>
 #include <Modules/LightSense.h>

using namespace std;
using namespace gadgeteering;
using namespace gadgeteering::mainboards;
using namespace gadgeteering::modules;

int main(int argc, char** argv)
	fez_lynx_s4 board;
	light_sense sensor(1);

		cout << "Light reading: " << sensor.get_illuminance() << endl;
		cout << "Light sensor percent: " << sensor.read_percentage() << endl;
		cout << "Light sensor voltage input: " << sensor.read_voltage() << endl << endl;


	return 0;

I not much experience with the gadgeteering SDK so far, but it’s definitely not an lib problem.
You should look for the include path.

#inlucde <…> (with angle brackets means to look in one/all the include path for the file.
Gadgeteering.h, Mainboards/… and Modules/… is all under “\Documents\Arduino\libraries\Gadgeteering\src” (if Gadgeteering SDK is installed correctly.
My one and only MedusaMini project is located in “\Documents\Arduino<prjName>” and does not have any problems to find these files.

@ sw. I ran into the same problem and was able to resolve it by changing the IncludePath and LibraryPath to the following:

@ scardinale - Thanks, that resolved the initial issue.

Unfortunately, I’m experiencing new errors. Any suggestions for resolving the following errors?

error LNK2038: mismatch detected for ‘_MSC_VER’: value ‘1700’ doesn’t match value ‘1800’ in Main.obj

error LNK2019: unresolved external symbol “__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits > & __cdecl std::endl(class std::basic_ostream<char,struct std::char_traits > &)” (_imp?endl@ std@ @ YAAAV?$basic_ostream@ DU?$char_traits@ D@ std@ @ @ 1@ AAV21@ @ Z) referenced in function “void __cdecl gadgeteering::system::print(int)” (?print@ system@ gadgeteering@ @ YAXH@ Z)

error LNK1120: 1 unresolved externals

@ sw

I’m glad that was helpful. Unfortunately, I am very new to C++ and am only learning. It might be due to you using VS 2013 and I’m using VS 2012.

Try starting from scratch using the FEZ Lynx S4 Console Application Template and see if that works for you.

Other than that, I will defer to the C++ Gods in the Forum.

In the current release of the Gadgeteering SDK, the tests inside the folder are setup to work with our local development setup. Changing the paths as scardinale did will allow them to work. As for the linker error, the libraries we ship are built to work with the v110 platform toolset. Since we currently only ship static libraries, your project must use the same toolset to link properly. Visual Studio 2013 defaults to the v120 toolset which is _MSC_VER 1800. v110 is _MSC_VER 1700. To change the toolset your project uses, right click the project in the Solution Explorer, click properties, then under Configuration Properties > General, change Platform Toolset to Visual Studio 2012 (v110) and you should be able to compile.