Can anyone tell me what is the problem?

Just create a project and run it and it will report an error message.

Please show the content of your platformio.ini and a smallest possible example to reproduce the error.

Please use preformatted-text when posting file-content or code

This is a duplicate of èż™æ˜Żä»€äčˆæƒ…憔äžș什äčˆć€±èŽ„why?
Please ask questions just once.

1 Like

[env:esp01]

platform = espressif8266

board = esp01

framework = arduino

44444

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 8266 (4.2.1) > Espressif Generic ESP8266 ESP-01 512k
HARDWARE: ESP8266 80MHz, 80KB RAM, 512KB Flash
PACKAGES:

  • framework-arduinoespressif8266 @ 3.30102.0 (3.1.2)
  • tool-esptool @ 1.413.0 (4.13)
  • tool-esptoolpy @ 1.30000.201119 (3.0.0)
  • toolchain-xtensa @ 2.100300.220621 (10.3.0)
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 37 compatible libraries
    Scanning dependencies

    No dependencies
    Building in release mode
    Compiling .pio\build\esp01\FrameworkArduino\core_esp8266_timer.cpp.o
    Compiling .pio\build\esp01\FrameworkArduino\core_esp8266_wiring.cpp.o
    Compiling .pio\build\esp01\FrameworkArduino\core_esp8266_wiring_analog.cpp.o
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:32:17: error: ‘timercallback’ does not name a type
    32 | static volatile timercallback timer1_user_cb = NULL;
    | ^~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer1_isr_handler(void*, void*)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:37:10: error: ‘T1C’ was not declared in this scope
    37 | if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:37:23: error: ‘TCAR’ was not declared in this scope
    37 | if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:37:37: error: ‘TCIT’ was not declared in this scope
    37 | if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:37:51: error: ‘TEIE’ was not declared in this scope
    37 | if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:37:60: error: ‘TEIE1’ was not declared in this scope
    37 | if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
    | ^~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:38:5: error: ‘T1I’ was not declared in this scope
    38 | T1I = 0;
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:39:9: error: ‘timer1_user_cb’ was not declared in this scope
    39 | if (timer1_user_cb) {
    | ^~~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:42:28: error: ‘xt_rsil’ was not declared in this scope
    42 | uint32_t savedPS = xt_rsil(15); // stop other interrupts
    | ^~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:44:9: error: ‘xt_wsr_ps’ was not declared in this scope
    44 | xt_wsr_ps(savedPS);
    | ^~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: At global scope:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:52:16: error: variable or field ‘timer1_attachInterrupt’ declared
    void
    52 | void IRAM_ATTR timer1_attachInterrupt(timercallback userFunc) {
    | ^~~~~~~~~~~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:52:39: error: ‘timercallback’ was not declared in this scope
    52 | void IRAM_ATTR timer1_attachInterrupt(timercallback userFunc) {
    | ^~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer1_detachInterrupt()’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:58:5: error: ‘timer1_user_cb’ was not declared in this scope
    58 | timer1_user_cb = 0;
    | ^~~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:59:5: error: ‘TEIE’ was not declared in this scope
    59 | TEIE &= ~TEIE1;//edge int disable
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:59:14: error: ‘TEIE1’ was not declared in this scope
    59 | TEIE &= ~TEIE1;//edge int disable
    | ^~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer1_enable(uint8_t, uint8_t, uint8_t)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:64:5: error: ‘T1C’ was not declared in this scope
    64 | T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:64:17: error: ‘TCTE’ was not declared in this scope
    64 | T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:64:43: error: ‘TCPD’ was not declared in this scope
    64 | T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:64:70: error: ‘TCIT’ was not declared in this scope
    64 | T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:64:95: error: ‘TCAR’ was not declared in this scope
    64 | T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:65:5: error: ‘T1I’ was not declared in this scope
    65 | T1I = 0;
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer1_write(uint32_t)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:69:5: error: ‘T1L’ was not declared in this scope
    69 | T1L = ((ticks)& 0x7FFFFF);
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:70:10: error: ‘T1C’ was not declared in this scope
    70 | if ((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:70:22: error: ‘TCIT’ was not declared in this scope
    70 | if ((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:70:35: error: ‘TEIE’ was not declared in this scope
    70 | if ((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
    | ^~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:70:43: error: ‘TEIE1’ was not declared in this scope
    70 | if ((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
    | ^~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer1_disable()’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:74:5: error: ‘T1C’ was not declared in this scope
    74 | T1C = 0;
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:75:5: error: ‘T1I’ was not declared in this scope
    75 | T1I = 0;
    | ^~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: At global scope:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:81:17: error: ‘timercallback’ does not name a type
    81 | static volatile timercallback timer0_user_cb = NULL;
    | ^~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer0_isr_handler(void*, void*)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:86:9: error: ‘timer0_user_cb’ was not declared in this scope
    86 | if (timer0_user_cb) {
    | ^~~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:89:28: error: ‘xt_rsil’ was not declared in this scope
    89 | uint32_t savedPS = xt_rsil(15); // stop other interrupts
    | ^~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:91:9: error: ‘xt_wsr_ps’ was not declared in this scope
    91 | xt_wsr_ps(savedPS);
    | ^~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: At global scope:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:99:16: error: variable or field ‘timer0_attachInterrupt’ declared
    void
    99 | void IRAM_ATTR timer0_attachInterrupt(timercallback userFunc) {
    | ^~~~~~~~~~~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:99:39: error: ‘timercallback’ was not declared in this scope
    99 | void IRAM_ATTR timer0_attachInterrupt(timercallback userFunc) {
    | ^~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp: In function ‘void timer0_detachInterrupt()’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_timer.cpp:105:5: error: ‘timer0_user_cb’ was not declared in this scope
    105 | timer0_user_cb = NULL;
    | ^~~~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring_analog.cpp: In function ‘int __analogRead(uint8_t)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring_analog.cpp:37:12: error: ‘digitalRead’ was not declared in this scop
    e
    37 | return digitalRead(pin) * 1023;
    | ^~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring_analog.cpp: In function ‘void __analogReference(uint8_t)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring_analog.cpp:46:17: error: ‘DEFAULT’ was not declared in this scope
    46 | if (mode != DEFAULT) {
    | ^~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring_analog.cpp:47:9: error: ‘DEBUGV’ was not declared in this scope; did
    you mean ‘UDEBUG’?
    47 | DEBUGV(“analogReference called with illegal mode”);
    | ^~~~~~
    | UDEBUG
    *** [.pio\build\esp01\FrameworkArduino\core_esp8266_timer.cpp.o] Error 1
    *** [.pio\build\esp01\FrameworkArduino\core_esp8266_wiring_analog.cpp.o] Error 1
    In file included from D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring.cpp:24:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring.cpp: In function ‘void delayMicroseconds(unsigned int)’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\tools\sdk\include/osapi.h:36:21: error: ‘ets_delay_us’ was not declared in this scope; did you mean ‘o
    s_delay_us’?
    36 | #define os_delay_us ets_delay_us
    | ^~~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring.cpp:192:5: note: in expansion of macro ‘os_delay_us’
    192 | os_delay_us(us);
    | ^~~~~~~~~~~
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring.cpp: In function ‘void init()’:
    D:\PlatformIO_Core\packages\framework-arduinoespressif8266\cores\esp8266\core_esp8266_wiring.cpp:197:5: error: ‘timer1_isr_init’ was not declared in this scope
    197 | timer1_isr_init();
    | ^~~~~~~~~~~~~~~
    *** [.pio\build\esp01\FrameworkArduino\core_esp8266_wiring.cpp.o] Error 1
    ================================================================== [FAILED] Took 3.41 seconds ==================================================================

Thanks for sharing the content of your platformio.ini.

But I’m still missing the code


And
 please use preformatted-text as statet above.
Nobody wants to type code from a screenshot :wink:

1 Like

main.c:

#include <Arduino.h>

// put function declarations here:
int myFunction(int, int);

void setup() {
// put your setup code here, to run once:
int result = myFunction(2, 3);
}

void loop() {
// put your main code here, to run repeatedly:

}

// put function definitions here:
int myFunction(int x, int y) {
return x + y;
}

It looks like your platform or the platform packages are broken.

  • Close VS Code
  • Delete the content of D:\PlatformIO_Core\packages
  • Delete the content of D:\PlatformIO_Core\platforms
  • Start VS Code
  • Wait until PlatformIO performed all necessary tasks

Note: Your path “D:\PlatformIO_Core” is very unusual!
Usually this folder is located at “C:\Users\<username>\.platformio”.

Maybe your whole PlatformIO installation is broken and should be reinstalled.

Again: When you post code, logs ini-files etc, please use the preformatted-text feature!
This makes your code much more readable and avoids error in formatting.
Thanks in advance!

1 Like

ok,i got it,in fact,I am used to downloading the installed stuff to a place other than the C drive, so that I can keep enough space on the C drive to make the computer run smoothly.But I didn’t expect it would cause this series of problems

You can use environment varialbles to change some destination folders when installing PlatformIO or Platforms. But those must be set before installing PlatformIO or the platforms and pacakges.

See Environment Variables — PlatformIO latest documentation

I would call this as “advanced stuff” and you should know what you’re doing.

For beginners, I recommend: keep it simple and use the default settings.

1 Like

Thank you very much for your suggestions. I deleted all the files and reinstalled them on the D drive. When I ran the project, it compiled successfully.