Problem compiling example: MCP4561

Hi,

I would like to use the Microchip Digital Potentiometer, MCP4561.
I have found a library that I thought I could use. However....

My debugging skills are not up to the job of getting it working.
Can anyone find a few moment to have a look and point me in the right direction?

I am using the Arduino 1.8.4 IDE and the library is here: SinglePotExample

Thanks in advance.

Regards, Martin

Please post the code you are trying to compile and the error messages that you get.

How and where did you install the library ?

Hi UKHeliBob,

The code I am running is in the link in the original posting. The error messages I get are:

..... abridged ....
Compiling libraries...
Compiling library "MCP4561"
"/opt/arduino-1.8.4/hardware/tools/avr/bin/avr-gcc" -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/opt/arduino-1.8.4/hardware/arduino/avr/cores/arduino" "-I/opt/arduino-1.8.4/hardware/arduino/avr/variants/standard" "-I/home/mprowe/Arduino/libraries/MCP4561" "-I/opt/arduino-1.8.4/hardware/arduino/avr/libraries/Wire/src" "/home/mprowe/Arduino/libraries/MCP4561/MCP4561.c" -o "/tmp/arduino_build_701292/libraries/MCP4561/MCP4561.c.o"
In file included from /home/mprowe/Arduino/libraries/MCP4561/MCP4561.c:2:0:
/home/mprowe/Arduino/libraries/MCP4561/MCP4561.h:13:2: error: unknown type name 'class'
  class MCP4561
  ^
/home/mprowe/Arduino/libraries/MCP4561/MCP4561.h:14:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  {
  ^

The full error log exceeds the max character count for these posting.

I installed the library by downloading from the GitHub, and using the Library Manager ti "Install from zip". You can see the location in the error strings.

I have corrected a typo at line 127 of the example program. And changed the

		//#include "WProgram.h"
		#include "Arduino.h"

at line 7 in MCP4562.h. But that is the limit of my skills!

Regards, Martin

"error: unknown type name 'class'"

I think it's not compiling the code as C++ because it uses the .c extension.

"/Arduino/libraries/MCP4561/MCP4561.c"

Rename that file to:
"/Arduino/libraries/MCP4561/MCP4561.cpp"