Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit bca93f8

Browse files
authored
v1.2.0 to fix multiple-definitions linker error
### Releases v1.2.0 1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories 2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project. 3. Add `platformio.ini`
1 parent 0fdd208 commit bca93f8

File tree

15 files changed

+3340
-2504
lines changed

15 files changed

+3340
-2504
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1414

1515
Please ensure to specify the following:
1616

17-
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
18-
* `ESP32` Core Version (e.g. ESP32 core v2.0.0)
17+
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18+
* `ESP32` Core Version (e.g. ESP32 core v2.0.2)
1919
* `ESP32` Board type (e.g. ESP32_DEV, ESP32S2_DEV Module, ESP32_S2_Saola, etc.)
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -27,11 +27,11 @@ Please ensure to specify the following:
2727
### Example
2828

2929
```
30-
Arduino IDE version: 1.8.16
31-
ESP32 core v2.0.0
30+
Arduino IDE version: 1.8.19
31+
ESP32 core v2.0.2
3232
ESP32_DEV Module
3333
OS: Ubuntu 20.04 LTS
34-
Linux xy-Inspiron-3593 5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
34+
Linux xy-Inspiron-3593 5.4.0-96-generic #109-Ubuntu SMP Wed Jan 12 16:49:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3535
3636
Context:
3737
I encountered a crash while using TimerInterrupt.

README.md

Lines changed: 103 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## Table of contents
1313

14-
* [Table of contents](#table-of-contents)
14+
* [Important Change from v1.2.0](#Important-Change-from-v120)
1515
* [Why do we need this AsyncTCP_SSL library](#why-do-we-need-this-AsyncTCP_SSL-library)
1616
* [Features](#features)
1717
* [Why Async is better](#why-async-is-better)
@@ -31,6 +31,8 @@
3131
* [3. ESP32 WiFi uses ADC2 for WiFi functions](#3-esp32-wifi-uses-adc2-for-wifi-functions)
3232
* [Orignal documentation](#Orignal-documentation)
3333
* [AsyncSSLClient](#AsyncSSLClient)
34+
* [Examples](#examples)
35+
* [1. multiFileProject](examples/multiFileProject)
3436
* [Debug Terminal Output Samples](#debug-terminal-output-samples)
3537
* [1. AsyncHTTPSRequest_ESP on ESP32_DEV](#1-AsyncHTTPSRequest_ESP-on-ESP32_DEV)
3638
* [2. AsyncHTTPSRequest_ESP on ESP32S2_DEV](#2-AsyncHTTPSRequest_ESP-on-ESP32S2_DEV)
@@ -49,6 +51,10 @@
4951
---
5052
---
5153

54+
### Important Change from v1.2.0
55+
56+
Please have a look at [HOWTO Fix `Multiple Definitions` Linker Error](#howto-fix-multiple-definitions-linker-error)
57+
5258
### Why do we need this [AsyncTCP_SSL library](https://github.com/khoih-prog/AsyncTCP_SSL)
5359

5460
#### Features
@@ -90,8 +96,8 @@ to apply the better and faster **asynchronous** feature of the **powerful** [Asy
9096

9197
## Prerequisites
9298

93-
1. [`Arduino IDE 1.8.16+` for Arduino](https://www.arduino.cc/en/Main/Software)
94-
2. [`ESP32 Core 2.0.0+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
99+
1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
100+
2. [`ESP32 Core 2.0.2+`](https://github.com/espressif/arduino-esp32) for ESP32-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
95101

96102
---
97103
---
@@ -148,13 +154,23 @@ Thanks to [Roshan](https://github.com/solroshan) to report the issue in [Error e
148154

149155
### HOWTO Fix `Multiple Definitions` Linker Error
150156

151-
The current library implementation, using xyz-Impl.h instead of standard xyz.cpp, possibly creates certain `Multiple Definitions` Linker error in certain use cases. Although it's simple to just modify several lines of code, either in the library or in the application, the library is adding a separate source directory, named src_cpp, besides the standard src directory.
157+
The current library implementation, using `xyz-Impl.h` instead of standard `xyz.cpp`, possibly creates certain `Multiple Definitions` Linker error in certain use cases.
158+
159+
You can include this `.hpp` file
160+
161+
```
162+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
163+
#include "AsyncTCP_SSL.hpp" //https://github.com/khoih-prog/AsyncTCP_SSL
164+
```
152165

153-
To use the old standard cpp way, just
166+
in many files. But be sure to use the following `.h` file **in just 1 `.h`, `.cpp` or `.ino` file**, which must **not be included in any other file**, to avoid `Multiple Definitions` Linker Error
167+
168+
```
169+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
170+
#include "AsyncTCP_SSL.h" //https://github.com/khoih-prog/AsyncTCP_SSL
171+
```
154172

155-
1. **Rename the h-only src directory into src_h.**
156-
2. **Then rename the cpp src_cpp directory into src.**
157-
3. Close then reopen the application code in Arduino IDE, etc. to recompile from scratch.
173+
Check the new [**multiFileProject** example](examples/multiFileProject) for a `HOWTO` demo.
158174

159175
---
160176
---
@@ -232,6 +248,12 @@ This is a fully asynchronous SSL TCP library, aimed at enabling trouble-free, mu
232248

233249
The base classes on which everything else is built. They expose all possible scenarios, but are really raw and require more skills to use.
234250

251+
---
252+
---
253+
254+
### Examples
255+
256+
1. [multiFileProject](examples/multiFileProject). **New**
235257

236258
---
237259
---
@@ -244,47 +266,46 @@ Following is the debug terminal when running example [AsyncHTTPSRequest_ESP](htt
244266

245267
```
246268
Starting AsyncHTTPSRequest_ESP using ESP32_DEV
247-
AsyncTCP_SSL v1.1.0
248-
AsyncHTTPSRequest_Generic v1.0.0
269+
AsyncTCP_SSL v1.2.0
270+
AsyncHTTPSRequest_Generic v1.3.0
249271
Connecting to WiFi SSID: HueNet1
250272
.......
251-
AsyncHTTPSRequest @ IP : 192.168.2.78
273+
AsyncHTTPSRequest @ IP : 192.168.2.133
252274
253275
**************************************
254-
abbreviation: EDT
276+
abbreviation: EST
255277
client_ip: aaa.bbb.ccc.ddd
256-
datetime: 2021-10-21T16:05:03.170256-04:00
257-
day_of_week: 4
258-
day_of_year: 294
259-
dst: true
260-
dst_from: 2021-03-14T07:00:00+00:00
261-
dst_offset: 3600
262-
dst_until: 2021-11-07T06:00:00+00:00
278+
datetime: 2022-01-23T21:17:05.405121-05:00
279+
day_of_week: 0
280+
day_of_year: 23
281+
dst: false
282+
dst_from:
283+
dst_offset: 0
284+
dst_until:
263285
raw_offset: -18000
264286
timezone: America/Toronto
265-
unixtime: 1634846703
266-
utc_datetime: 2021-10-21T20:05:03.170256+00:00
267-
utc_offset: -04:00
268-
week_number: 42
287+
unixtime: 1642990625
288+
utc_datetime: 2022-01-24T02:17:05.405121+00:00
289+
utc_offset: -05:00
290+
week_number: 3
269291
**************************************
270292
HHHHHH
271293
**************************************
272-
abbreviation: EDT
294+
abbreviation: EST
273295
client_ip: aaa.bbb.ccc.ddd
274-
datetime: 2021-10-21T16:06:00.828056-04:00
275-
day_of_week: 4
276-
day_of_year: 294
277-
dst: true
278-
dst_from: 2021-03-14T07:00:00+00:00
279-
dst_offset: 3600
280-
dst_until: 2021-11-07T06:00:00+00:00
296+
datetime: 2022-01-23T21:18:03.759271-05:00
297+
day_of_week: 0
298+
day_of_year: 23
299+
dst: false
300+
dst_from:
301+
dst_offset: 0
302+
dst_until:
281303
raw_offset: -18000
282304
timezone: America/Toronto
283-
unixtime: 1634846760
284-
utc_datetime: 2021-10-21T20:06:00.828056+00:00
285-
utc_offset: -04:00
286-
week_number: 42
287-
**************************************
305+
unixtime: 1642990683
306+
utc_datetime: 2022-01-24T02:18:03.759271+00:00
307+
utc_offset: -05:00
308+
week_number: 3
288309
```
289310
---
290311

@@ -294,8 +315,8 @@ Following is the debug terminal when running example [AsyncHTTPSRequest_ESP](htt
294315

295316
```
296317
Starting AsyncHTTPSRequest_ESP using ESP32S2_DEV
297-
AsyncTCP_SSL v1.1.0
298-
AsyncHTTPSRequest_Generic v1.0.0
318+
AsyncTCP_SSL v1.2.0
319+
AsyncHTTPSRequest_Generic v1.3.0
299320
Connecting to WiFi SSID: HueNet1
300321
.......
301322
AsyncHTTPSRequest @ IP : 192.168.2.79
@@ -323,23 +344,22 @@ AsyncHTTPSRequest @ IP : 192.168.2.79
323344
[ATCP] _sent: len = 106
324345
[ATCP] _handle_async_event: LWIP_TCP_RECV = 0x3FFE5024
325346
[ATCP] _recv: tot_len = 1016
326-
327347
**************************************
328-
abbreviation: EDT
348+
abbreviation: EST
329349
client_ip: aaa.bbb.ccc.ddd
330-
datetime: 2021-10-21T23:19:43.835205-04:00
331-
day_of_week: 4
332-
day_of_year: 294
333-
dst: true
334-
dst_from: 2021-03-14T07:00:00+00:00
335-
dst_offset: 3600
336-
dst_until: 2021-11-07T06:00:00+00:00
350+
datetime: 2022-01-23T21:21:03.766116-05:00
351+
day_of_week: 0
352+
day_of_year: 23
353+
dst: false
354+
dst_from:
355+
dst_offset: 0
356+
dst_until:
337357
raw_offset: -18000
338358
timezone: America/Toronto
339-
unixtime: 1634872783
340-
utc_datetime: 2021-10-22T03:19:43.835205+00:00
341-
utc_offset: -04:00
342-
week_number: 42
359+
unixtime: 1642990863
360+
utc_datetime: 2022-01-24T02:21:03.766116+00:00
361+
utc_offset: -05:00
362+
week_number: 3
343363
**************************************
344364
```
345365

@@ -351,28 +371,27 @@ Following is the debug terminal when running example [AsyncHTTPSRequest_ESP](htt
351371

352372
```
353373
Starting AsyncHTTPSRequest_ESP using ESP32C3_DEV
354-
AsyncTCP_SSL v1.1.0
355-
AsyncHTTPSRequest_Generic v1.0.0
374+
AsyncTCP_SSL v1.2.0
375+
AsyncHTTPSRequest_Generic v1.3.0
356376
Connecting to WiFi SSID: HueNet1
357377
.........
358378
AsyncHTTPSRequest @ IP : 192.168.2.80
359-
360379
**************************************
361-
abbreviation: EDT
380+
abbreviation: EST
362381
client_ip: aaa.bbb.ccc.ddd
363-
datetime: 2021-10-22T02:00:44.009661-04:00
364-
day_of_week: 5
365-
day_of_year: 295
366-
dst: true
367-
dst_from: 2021-03-14T07:00:00+00:00
368-
dst_offset: 3600
369-
dst_until: 2021-11-07T06:00:00+00:00
382+
datetime: 2022-01-23T21:24:07.839337-05:00
383+
day_of_week: 0
384+
day_of_year: 23
385+
dst: false
386+
dst_from:
387+
dst_offset: 0
388+
dst_until:
370389
raw_offset: -18000
371390
timezone: America/Toronto
372-
unixtime: 1634882444
373-
utc_datetime: 2021-10-22T06:00:44.009661+00:00
374-
utc_offset: -04:00
375-
week_number: 42
391+
unixtime: 1642991047
392+
utc_datetime: 2022-01-24T02:24:07.839337+00:00
393+
utc_offset: -05:00
394+
week_number: 3
376395
**************************************
377396
```
378397

@@ -384,30 +403,30 @@ Following is the debug terminal when running example [AsyncHTTPSRequest_ESP_WiFi
384403

385404
```
386405
Starting AsyncHTTPSRequest_ESP_WiFiManager using LittleFS on ESP32_DEV
387-
ESPAsync_WiFiManager v1.9.4
388-
AsyncTCP_SSL v1.1.0
389-
AsyncHTTPSRequest_Generic v1.0.0
406+
ESPAsync_WiFiManager v1.11.0
407+
AsyncTCP_SSL v1.2.0
408+
AsyncHTTPSRequest_Generic v1.3.0
390409
Stored: SSID = HueNet1, Pass = 12345678
391410
Got stored Credentials. Timeout 120s
392411
ConnectMultiWiFi in setup
393412
After waiting 11.38 secs more in setup(), connection result is connected. Local IP: 192.168.2.232
394413
H
395414
**************************************
396-
abbreviation: EDT
415+
abbreviation: EST
397416
client_ip: aaa.bbb.ccc.ddd
398-
datetime: 2021-10-22T02:38:12.722777-04:00
399-
day_of_week: 5
400-
day_of_year: 295
401-
dst: true
402-
dst_from: 2021-03-14T07:00:00+00:00
403-
dst_offset: 3600
404-
dst_until: 2021-11-07T06:00:00+00:00
417+
datetime: 2022-01-23T21:18:03.759271-05:00
418+
day_of_week: 0
419+
day_of_year: 23
420+
dst: false
421+
dst_from:
422+
dst_offset: 0
423+
dst_until:
405424
raw_offset: -18000
406425
timezone: America/Toronto
407-
unixtime: 1634884692
408-
utc_datetime: 2021-10-22T06:38:12.722777+00:00
409-
utc_offset: -04:00
410-
week_number: 42
426+
unixtime: 1642990683
427+
utc_datetime: 2022-01-24T02:18:03.759271+00:00
428+
utc_offset: -05:00
429+
week_number: 3
411430
**************************************
412431
H
413432
```
@@ -447,6 +466,7 @@ Submit issues to: [AsyncTCP_SSL issues](https://github.com/khoih-prog/AsyncTCP_S
447466

448467
1. Search for bug and improvement.
449468
2. Similar Async SSL libraries for ESP8266, STM32, Portenta_H7 and many other boards
469+
3. Permit both HTTP and HTTPS
450470

451471
---
452472

@@ -455,6 +475,8 @@ Submit issues to: [AsyncTCP_SSL issues](https://github.com/khoih-prog/AsyncTCP_S
455475
1. Add support to ESP32 using SSL
456476
2. Add Table of Contents
457477
3. Add debug feature
478+
4. Fix `multiple-definitions` linker error
479+
5. Add example
458480

459481
---
460482
---

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
## Table of Contents
1212

1313
* [Changelog](#changelog)
14+
* [Releases v1.2.0](#Releases-v120)
1415
* [Releases v1.1.0](#Releases-v110)
1516
* [Initial Releases v1.0.0](#Initial-Releases-v100)
1617

@@ -19,6 +20,12 @@
1920

2021
## Changelog
2122

23+
### Releases v1.2.0
24+
25+
1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories
26+
2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project.
27+
3. Add `platformio.ini`
28+
2229
### Releases v1.1.0
2330

2431
1. Fix duplication bug when using `src_h`
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.cpp
3+
For ESP32
4+
5+
AsyncTCP_SSL is a library for the ESP32
6+
7+
Built by Khoi Hoang https://github.com/khoih-prog/AsyncTCP_SSL
8+
Licensed under MIT license
9+
*****************************************************************************************************************************/
10+
11+
// To demo how to include files in multi-file Projects
12+
13+
#include "multiFileProject.h"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.h
3+
For ESP32
4+
5+
AsyncTCP_SSL is a library for the ESP32
6+
7+
Built by Khoi Hoang https://github.com/khoih-prog/AsyncTCP_SSL
8+
Licensed under MIT license
9+
*****************************************************************************************************************************/
10+
11+
// To demo how to include files in multi-file Projects
12+
13+
#pragma once
14+
15+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
16+
#include "AsyncTCP_SSL.hpp"

0 commit comments

Comments
 (0)