0

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)

3
  • Serial.print(...) is a public method of class Serial; how did you initialized an object e.g. ser1 of type Serial 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...
    – Ian
    Commented Jun 20 at 11:22
  • @Ian Thank you... HardwareSerial.h has 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.
    – pedz
    Commented Jun 21 at 15:58
  • The library does HardwareSerial Serial(0); to initialize Serial.
    – pedz
    Commented Jun 21 at 16:05

1 Answer 1

0

This is not an emacs issue but a ccls misconfiguration. The first line of the .ccls file is "compiler driver (usually clang)". In my case, I am developing code for a "Cheap Yellow Display", using PlatformIO Core (CLI). This makes the path to the compiler driver ~/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc (since the board has an ESP32 SoC).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.