Compilation error: Error: 2 UNKNOWN: exit status 1 - Caused by dirty .h / .cpp files

I have stripped this down to nothing but the meat to make sure that i'm not going nuts for no reason.

I have my.ino file as such

#include <my_lib.h>

void setup()
{
  Serial.begin(115200);
  Serial.println("hello world");
}

void loop()
{
}

It references a library stored in "my documents/Arduino/libraries/mylibrary" which contains my_lib.h and my_lib.cpp

#ifndef MY_LIB_H
#define MY_LIB_H

#include <Arduino.h>
#include "WiFi.h"
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <string.h>
#include <ESP32Ping.h>

int addTwoInts(int a, int b);

#endif

Is a pretty standard header file, I also have a pretty standard .cpp file

#include "my_lib.h"
#include "WiFi.h"
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <string.h>
#include <ESP32Ping.h>

int addTwoInts(int a, int b)
{
  return a + b;
}

I literally have no idea what I'm doing wrong as it doesn't get simpler than this.

ESP32Ping.h is located in a folder within my libraries folder. With my working .ino (I am trying to turn my .ino into a library file) the library worked. I also have doubts wether to be using "wifi.h" or <wifi.h>

Is this the full and exact text of the error message, or did you add the "Caused by dirty .h / .cpp files" part on yourself to make the forum topic title descriptive?

Are all those #include directives necessary to reproduce the issue?

Are all those #include directives necessary to reproduce the issue?

Yes, getting rid of the includes results in compiling code.

Is this the full and exact text of the error message

Yes this is the full error message.

Judging by your reply you're probably just as confused as I am. I'm thinking of moving my project to platform IO since I have had no success with creating headers and my project is getting yuuge

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