I am going to put this question in the Emacs site even though it might be a ccls issue. The problem I see and describe below is within Emacs. Emacs version 30.1 on an M1 macOS 15.5.
I am doing development for a “Cheap Yellow Display” which is a ESP32 with a display and some other support chips. I am using PlatformIO rather than the Arduino IDE. With the current set up, I can build and load code whose source is on my Mac onto the development board and run it from within Emacs.
Some of the packages I have loaded in are platformio-mode, lsp-mode, ccls, and projectile. The platformio-mode creates a .ccls file with clang at the top and a number of -I and -D directives pulled from the development environment and pointing to the include files for an embedded eps32.
Much of the system is working. I have more than one issue but I will stick to only one here.
In a file called 2-TouchTest.cpp
are a sequence of calls to Serial.print()
such as Serial.print("Pressure = “);
. All of the calls are flagged with an error 82 2 error l-d---b no matching member function for call to 'print’
. Yet, if I do M-.
on Serial
it goes to the proper definition and if I do M-.
on print
it brings up the correct list of prototypes:
81: size_t print(const __FlashStringHelper *ifsh) { return print(reinterpret_cast<const char *>(ifsh)); }
82: size_t print(const String &);
83: size_t print(const char[]);
84: size_t print(char);
85: size_t print(unsigned char, int = DEC);
86: size_t print(int, int = DEC);
87: size_t print(unsigned int, int = DEC);
88: size_t print(long, int = DEC);
89: size_t print(unsigned long, int = DEC);
90: size_t print(long long, int = DEC);
91: size_t print(unsigned long long, int = DEC);
92: size_t print(double, int = 2);
93: size_t print(const Printable&);
94: size_t print(struct tm * timeinfo, const char * format = NULL);
Edit on 06/21/2025: In today's project, the error is cannot initialize object parameter of type 'Print' with an expression of type 'HardwareSerial'
for the line of code Serial.printf("c = %c\n", c);
(using printf
instead of print
)
Serial.print(...)
is a public method of classSerial
; how did you initialized an object e.g.ser1
of typeSerial
for one of the three dedicated hardware serial interfaces in your micro controller? Does your project works OK in PlatformIO without Emacs? For a display board I would prefer a high speed SPI interface (if available) rather a com/serial one, execution time matters...extern HardwareSerial Serial;
. (clearly I didn't write the code and I see your point that Serial normally would be the name of a class). In today's project, the error has changed (see Edit above). The project works with and without Emacs.HardwareSerial Serial(0);
to initializeSerial
.