PinChangeInt.h and Nexion library in same project

Hello,

in my project I use signal counter and itead nextion display library. For now Arduino Nano does signal counting with pinchaneit library and then sends data via I2C to Arduino Mega who manage all calculations and itead nextion display communication via serial port. Idea is to make all work only on arduino mega only.

When I include both library

#include “Nextion.h”
#include <PinChangeInt.h>

there is error

Archiving built core (caching) in: C:\Users\DJURAT~1\AppData\Local\Temp\arduino_cache_764877\core\core_arduino_avr_mega_cpu_atmega2560_0c812875ac70eb4a9b385d8fb077f54c.a
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':

(.text+0x0): multiple definition of `__vector_9'

sketch\sejalica2.1.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':

(.text+0x0): multiple definition of `__vector_11'

sketch\sejalica2.1.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':

(.text+0x0): multiple definition of `__vector_10'

sketch\sejalica2.1.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

How can this two library work in same sketch?

Links for library:

Why do you want to use Software Serial on the Mega if you have 3 additional serial ports available? Use Serial1, Serial2 or Serial3 and connect the Nexion to the associated pins on the Mega.

That might make the problem go away.

PS You get the error because both SoftwareSerial and PinChangeInt are using the same interrupts; if needed, you can disable the conflicting ISRs from the PinChangeInt library or just simply don't use the library and do it yourself (see Simple Pin Change Interrupt on all pins).

Thank you for help!

For Nextion I'm using hardware serial1. How can I disable software serial in Nextion library to eliminate error while compiling? I don't call software serial in sketch.

If I open empty sketch and include these two library I'm get error. Not sure where and how to disable software serial.

Disabling soft serial will make less changes to code than abandon pinchange library.