Code Issues for PR33-15/MCP3428

Hi,
New issue here… Working on getting the code together for the project I’m working on, but I’m admittedly a bit lost. I haven’t coded in almost 10yrs, and the sample code files for this PCB seem to be broken. “Right out of the box,” the MCP3428.cpp MCP3428.h files won’t compile (but the ReadAndPrint.pde file will) in the Arduino IDE (copy/paste), and there’s a very distinct and resounding lack of supporting documentation for any of the coding samples (in any of the languages), which I find pretty frustrating. It feels like you need to already have a solid familiarity with this hardware (and associated code/software) to get it up and running. Any help would be greatly appreciated, especially since coding has never been a strength of mine (I’m a hardware guy).

Hi,

Admittedly this line of products was developed for experience programmers who do not have experience with hardware. It allows them to create POC setups without having custom hardware developed/manufactured. You could say those users are the opposite of your skillset.

Our aim with this product line is to sell hardware at as low of cost as possible. We are essentially creating breakout boards for different I2C ICs. If we spend large amounts of time creating support documents and code we would have to drastically increase the cost of the product which negates the purpose of the line. The sample code we have was created by contracted developers and I’ll be the first to admit it’s not always the best, however I can attest that it has all been tested and did function when first created.

Can you share the compile errors you are getting so I can point you in the right direction?

Hi Travis,
I appreciate the help! I can definitely see that viewpoint and understand it, but it doesn’t ease the frustration…lol. Here is a copy of the compile logs from the Arduino IDE, this is just opening the file(s) in notepad and directly copy/pasting them and trying to compile.

MCP3428.cpp

Arduino: 1.8.13 (Windows 10), Board: “Arduino Uno”

The sketch name had to be modified.
Sketch names must start with a letter or number, followed by letters,
numbers, dashes, dots and underscores. Maximum length is 63 characters.

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\raven\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\raven\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\raven\Dropbox\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\raven\AppData\Local\Temp\arduino_build_66925 -warnings=default -build-cache C:\Users\raven\AppData\Local\Temp\arduino_cache_248857 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\raven\Dropbox\Arduino\M3428_cpp_test_compile\M3428_cpp_test_compile.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\raven\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\raven\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\raven\Dropbox\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\raven\AppData\Local\Temp\arduino_build_66925 -warnings=default -build-cache C:\Users\raven\AppData\Local\Temp\arduino_cache_248857 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\raven\Dropbox\Arduino\M3428_cpp_test_compile\M3428_cpp_test_compile.ino

Using board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Detecting libraries used…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for Wire.h: [Wire@1.0]

ResolveLibrary(Wire.h)

-> candidates: [Wire@1.0]

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for MCP3428.h: [MCP3428]

ResolveLibrary(MCP3428.h)

-> candidates: [MCP3428]

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.c” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Users\raven\Dropbox\Arduino\libraries\MCP3428\MCP3428.cpp” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Generating function prototypes…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\preproc\ctags_target_for_gcc_minus_e.cpp” -DARDUINO_LIB_DISCOVERY_PHASE

“C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags” -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\preproc\ctags_target_for_gcc_minus_e.cpp”

Compiling sketch…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o”

Compiling libraries…

Compiling library “Wire”

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.cpp” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\Wire\Wire.cpp.o”

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc” -c -g -Os -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility\twi.c” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\Wire\utility\twi.c.o”

Compiling library “MCP3428”

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src” “-IC:\Users\raven\Dropbox\Arduino\libraries\MCP3428” “C:\Users\raven\Dropbox\Arduino\libraries\MCP3428\MCP3428.cpp” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o”

Compiling core…

Using precompiled core: C:\Users\raven\AppData\Local\Temp\arduino_cache_248857\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a

Linking everything together…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc” -Os -g -flto -fuse-linker-plugin -Wl,–gc-sections -mmcu=atmega328p -o “C:\Users\raven\AppData\Local\Temp\arduino_build_66925/M3428_cpp_test_compile.ino.elf” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\Wire\Wire.cpp.o” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\Wire\utility\twi.c.o” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o” “C:\Users\raven\AppData\Local\Temp\arduino_build_66925/…\arduino_cache_248857\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a” “-LC:\Users\raven\AppData\Local\Temp\arduino_build_66925” -lm

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `MCP3428::init()’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `MCP3428::init(bool)’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `MCP3428::setAddress(int, int)’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `MCP3428::convertData(int*)’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `MCP3428::readChannel(int, int*, int)’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `MCP3428::takeReadings()’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\libraries\MCP3428\MCP3428.cpp.o (symbol from plugin): In function `MCP3428::init()’:

(.text+0x0): multiple definition of `last_checked’

C:\Users\raven\AppData\Local\Temp\arduino_build_66925\sketch\M3428_cpp_test_compile.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\raven\AppData\Local\Temp\cca9iV18.ltrans0.ltrans.o: In function `main’:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup’

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop’

collect2.exe: error: ld returned 1 exit status

Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire

Using library MCP3428 in folder: C:\Users\raven\Dropbox\Arduino\libraries\MCP3428 (legacy)

exit status 1

Error compiling for board Arduino Uno.


MCP3428.h

Arduino: 1.8.13 (Windows 10), Board: “Arduino Uno”

The sketch name had to be modified.
Sketch names must start with a letter or number, followed by letters,
numbers, dashes, dots and underscores. Maximum length is 63 characters.

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\raven\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\raven\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\raven\Dropbox\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\raven\AppData\Local\Temp\arduino_build_646195 -warnings=default -build-cache C:\Users\raven\AppData\Local\Temp\arduino_cache_248857 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\raven\Dropbox\Arduino\mcp3428_h_test_compile\mcp3428_h_test_compile.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\raven\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\raven\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\raven\Dropbox\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\raven\AppData\Local\Temp\arduino_build_646195 -warnings=default -build-cache C:\Users\raven\AppData\Local\Temp\arduino_cache_248857 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\raven\Dropbox\Arduino\mcp3428_h_test_compile\mcp3428_h_test_compile.ino

Using board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

Detecting libraries used…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\sketch\mcp3428_h_test_compile.ino.cpp” -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Generating function prototypes…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\sketch\mcp3428_h_test_compile.ino.cpp” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\preproc\ctags_target_for_gcc_minus_e.cpp” -DARDUINO_LIB_DISCOVERY_PHASE

“C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags” -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\preproc\ctags_target_for_gcc_minus_e.cpp”

Compiling sketch…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\sketch\mcp3428_h_test_compile.ino.cpp” -o “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\sketch\mcp3428_h_test_compile.ino.cpp.o”

Compiling libraries…

Compiling core…

Using precompiled core: C:\Users\raven\AppData\Local\Temp\arduino_cache_248857\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a

Linking everything together…

“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc” -Os -g -flto -fuse-linker-plugin -Wl,–gc-sections -mmcu=atmega328p -o “C:\Users\raven\AppData\Local\Temp\arduino_build_646195/mcp3428_h_test_compile.ino.elf” “C:\Users\raven\AppData\Local\Temp\arduino_build_646195\sketch\mcp3428_h_test_compile.ino.cpp.o” “C:\Users\raven\AppData\Local\Temp\arduino_build_646195/…\arduino_cache_248857\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a” “-LC:\Users\raven\AppData\Local\Temp\arduino_build_646195” -lm

C:\Users\raven\AppData\Local\Temp\cctpkyeb.ltrans0.ltrans.o: In function `main’:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup’

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop’

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Uno.

Post-holiday bump…

Hi,

The errors you are getting are multiple definition errors. This is most generally caused by multiple include statements either in the same file or in separate files. Without being able to see your project in entirety it’s not possible to tell you how to fix it. There is an issue with the structure of your project in some way that is causing this. I do not have any compilation problems with the library.

But that’s the thing – I’m getting these compile errors with JUST the .cpp and/or .h files. It’s literally a verbatim copy/paste into a blank/fresh sketch window in the Arduino IDE from the files inside the zip file on your github page.

Example:

  • Open .cpp file ( or .h file) contained inside zip file in notepad
  • copy/paste (Ctrl-A, Ctrl-C, Ctrl-V) into blank IDE window
  • verify/compile, and it breaks.

Open the Arduino IDE. On the menu navigator in Arduino click File > Open Through the browser navigate to MCP3428-Master/Arduino/MCP3428_Arduino_Library/Examples then select one of the two ino files from the two folders there. Now in Arduino click on Sketch > Add File… Now navigate to the location of the MCP3428.h and select it. Do the same for MCP3428.cpp.

Now the only changes you need to make are to the include line in the ino file, change #include <MCP3428.h> to #include “MCP3428.h”. Do the same in the MCP3428.cpp file. Now compile and see what you get. If this is still a problem then you may have manually installed the library in the Arduino IDE so you need to go into manage libraries and uninstall it.

Honestly this is not really support for our device or the library but rather how to use the Arduino IDE which is a bit outside our technical support perview. I did just confirm that the sample code you are using along with the libraries do compile correctly so I can assure you there is nothing wrong with them.

I definitely get that it’s out of your purview, and I really appreciate you taking the time anyway - it’s a testament to how great your customer service is. I just checked stuff on my end, and I don’t have that file/directory structure from the stuff I downloaded, and I also double-checked the github page and it also doesn’t line up with what you typed. This is according to github.com/ncd-io/MCP3428. Is there another source for the files that I missed? I can’t remember where I found the github page, I thought it was on the product page in the store, but I can’t currently find the links…pretty sure I got to github through your site though. Thanks again for your help, I appreciate it.

Hi,

That may be the issue. The code I was referencing was from here:

I will take a look at the code you referenced to see if I can find any issues there. The errors you reported are not necessarily errors in the code but in the structure of the files.

That’s definitely a bit of a difference in file structures. I downloaded the new set of files and followed your instructions above, and everything compiled like it should with no errors. Thank you again for taking the time to help me with this, I really do appreciate it. I’m definitely curious about the disparity between the source/sample files between the two github sources, especially since the one I pulled from appeared to be your official channel (I think I even got the link from your site somewhere). Thanks again!

I will look into that code when I get a chance and let you know what I find. The developer who created that code is a very talented programmer, it’s rare that he would have bad code on a public repo, but I’ll check it out.