softserial and PinChangeInterrupt won't compile together

Before I added SoftwareSerial, this worked fine. Now it won’t compile. I really need to use both together.

Get this:

PinChangeInterrupt.a(PinChangeInterrupt1.cpp.o):In function __vector_4 PinChangeInterrupt1.cpp:multiple definition of __vector_4
SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:229: first defined here
:error: ld returned 1 exit status
Error creating .elf

Any thoughts?

#include "PinChangeInterrupt.h"
#include <SoftwareSerial.h>
// Choose a valid PinChangeInterrupt pin of your Arduino board
#define busWrtADC A5
#define busWrtDAC A4

#define t 8

#define r 9

SoftwareSerial mySerial = SoftwareSerial(r, t);

void setup() {
	pinMode(r, INPUT);
	pinMode(t, OUTPUT);
	pinMode(busWrtADC, INPUT_PULLUP);
	pinMode(busWrtDAC, INPUT_PULLUP);

	// Attach the new PinChangeInterrupt and enable event function below

	attachPCINT(digitalPinToPCINT(busWrtADC), adc, CHANGE);
	attachPCINT(digitalPinToPCINT(busWrtDAC), dac, CHANGE);


void adc(void) {


void dac(void) {


void loop() {
	// Nothing to do here

Some varieties of Software Serial make use of pin change interrupts. You may have a conflict.

By the way, print makes use of interrupts. Using interrupts from within an Interrupt Service Routine is risky and likely to fail at a bad time.

PinChangeInterrupt1.cpp:multiple definition of `__vector_4

Both libraries are using the same interrupt vector 4, which is Pin Change Interrupt Request 0 (pins D8 to D13) (PCINT0_vect)

#define t 8

#define r 9

SoftwareSerial mySerial = SoftwareSerial(r, t);

Since you are using A4/A5, (and not using pins 8 -13 for the desired pin change interrupt) but only the software serial is using those pins, you might be able to modify the library source code for "PinChangeInterrupt.h" to not set up possible interrupts on those pins.

Alternatively you could use AltSoftSerial Library which uses timers instead of pin change interrupts.