Problem with #include<>

Hi everybody :slight_smile:
I wrote a program for Due with a library which can work with several card.
The program compile perfectly fine if the selected Arduino card is a DUE.
When I try to compile the same code with a MEGA2560, this is the message that I got:

In file included from D:\Users\Documents\Arduino\New_AC_monitor_N2k\New_AC_monitor_N2k.ino:13:0:
D:\Users\Documents\Arduino\libraries\NMEA2000-master\src/NMEA2000_CAN.h:196:10: fatal error: NMEA2000_mcp.h: No such file or directory
 #include <NMEA2000_mcp.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: exit status 1

I could understand aa compatibility problem but it looks like the program can't find the library when I select the MEGA but can find it when it's a DUE...
Can someone can explain what is happening and if there is a way to solve this problem.

Where exactly is NMEA2000_mcp.h located on your PC ?

Looking at the NMEA2000_CAN.h file, there is the following:

  <b>Depending of your board you will need to also install "driver" libraries:</b>  

  see also \ref secHWlib

  Arduino CAN shield (mcp_can) with MCP2515 chip:
    - https://github.com/ttlappalainen/CAN_BUS_Shield
    - https://github.com/ttlappalainen/NMEA2000_mcp
    
  Arduino DUE internal CAN:
    - https://github.com/ttlappalainen/due_can
    - https://github.com/ttlappalainen/NMEA2000_due
    
  Teensy 3.2-3.6 internal CAN:
    - https://github.com/ttlappalainen/FlexCAN_Library
    - https://github.com/ttlappalainen/NMEA2000_teensy
    
  Teensy 4.X internal CAN:
    - https://github.com/ttlappalainen/NMEA2000_Teensyx
    
  ESP32 internal CAN:
    - https://github.com/ttlappalainen/NMEA2000_esp32
  
  AVR:
    - https://github.com/thomasonw/avr_can
    - https://github.com/thomasonw/NMEA2000_avr
  
  MBED (note that there may be problem with fastpackets on MBED):
    - https://github.com/thomasonw/NMEA2000_mbed
    
  RPi socket CAN:
    -  https://github.com/thomasonw/NMEA2000_socketCAN
  

Sorry for late reply, busy week...
@UKHeliBob. Thank you for your reply, NMEA2000_mcp.h and the .cpp is not on my computer. my mistake. this command line is inside the library NMEA2000_CAN.h
Sorry.
@david_2018 yes, Thank you for your answer. you probably right, I didn't realized that Library didn't call the same files depending on the card. Really sorry, I will download the files and test again.

Many Thanks to both of you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.