• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Compiler error – "invalid conversion from 'const char*' to 'char*' -fpermissive"

Q&A Forum › Category: ESP32 › Compiler error – "invalid conversion from 'const char*' to 'char*' -fpermissive"
0 Vote Up Vote Down
Dick Gingras asked 4 years ago

ESP32 LoRa Sensor Monitoring with Web Server (Long Range Communication) project
Arduino version 1.8.13 (using Heltec WiFi LoRa 32 V2 development board)
Error occurs when compiling at line 150 – WiFi.begin(ssid, password);

9 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
Do you get this error with other web server projects in the course, or only with this one?
Regards,
Sara

0 Vote Up Vote Down
Dick Gingras answered 4 years ago

This is my first. The code came straight from your sketch. The only changes I made were to the #define BAND 915E6 and the const char* ssid = “…” and const char* password = “…” constants.
I tried Googling the problem but couldn’t understand how to solve it. I hope you can help.
 

0 Vote Up Vote Down
Dick Gingras answered 4 years ago

The libraries are up to date but I wonder if the Arduino 1.8.13 build may be the problem.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi again.
I’m also using that version of Arduino IDE. So that is not the issue.
Did you install the ESP32 boards’ add-on in the Arduino IDE? What’s the version that you have?
What is the board that you selected in Tools > Board?
Regards,
Sara
 

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I can’t recall exactly the prototype for the begin function but I believe it’s expecting as first parameter a parameter of type char* instead of const char*. Try changing the parameter type of ssid and/or password. ie. Take out the const for one, then the other then both. Also, is either one just a single character? If so, change the double quote to a single quote and try that. A single character is changed to a char type instead of *char (An array char).

0 Vote Up Vote Down
Dick Gingras answered 4 years ago

Sara – I’m using Heltec WiFi LoRa 32 V2 development board which I selected in the Tools menu. I’m not sure what you mean when you asked if I installed the ESP32 boards’ add-on in the Arduino IDE unless you are referring to this. The puzzling thing is that no one seemed to have a similar problem with your sketch. The only other issue I have is error: ‘class NTPClient’ has no member named ‘getFormattedDate’ formattedDate = timeClient.getFormattedDate(); but I don’t think this should have any bearing on the other issue.
Steve – both ssid and password are multiple characters. When I just went with char* ssid = “GoofiGuest”; I got error: expected ‘{‘ before ‘;’ token char* ssid = [“GoofiGuest”]; Similar error message for char* password

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi again.

You get the ‘class NTPClient’ has no member named ‘getFormattedDate’ error because you probably haven’t installed the proper NTPClient library. We’re using the library forked by Taranais, not the regular NTP Client library, as mentioned in the tutorial.
Follow the next steps to install this library in your Arduino IDE:

  1. Click here to download the NTPClient library. You should have a .zip folder in your Downloads
  2. In your Arduino IDE, go to Sketch > Include Libraries > Add . ZIP Library and choose the library you’ve just downloaded.

After this, that error should go away.

As for the other issue, try with the following:

char* ssid = "YOUR_SSID";
char* password = "YOUR_PASSWORD";

or

char ssid[] = "YOUR_SSID"; 
const char* password = "YOUR_PASSWORD";

Regards,
Sara

0 Vote Up Vote Down
Dick Gingras answered 4 years ago

Hi Sara,
Your solution for the NTPClient library worked. Ironically, I had downloaded  the NTPClient-master library before and must have deleted the wrong when after the compiler warned than I had multiple libraries. That part works fine now. Thanks!
Unfortunately, your 2nd suggestion (removing the *) didn’t help.I got the same compiler error that I first reported.
your first suggestion to eliminate the const part of the line fixed the compiler error, but I can’t connect to WiFi because while (WiFi.status() != WL_CONNECTED) {…} loops continuously. Out of desperation, I pasted the actual values for ssid and password into WiFi.begin(“…”, “…”) and WiFi still won’t connect.
I even tried your suggestions with the WiFi library example WiFiClient.ino, which uses the same const char* construct and WiFi.begin(ssid, password) statement but I got the same results I experienced with your program. (I’m using WiFi library version 2.0.0).
Clearly the problem is on my end but I can’t figure out what is causing it.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
When you type the credentials right into WiFi.begin(), it must work and connect.
Unless the credentials are not correct or the Wi-Fi is not working on your board.
Does your board have an antenna? Is it connected properly? Can you check if the antenna is not damaged?
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.