Do i wrong to Define 2 Env different Board/chips?

I have 2 env (ESP8266 and ESP32)
i do commenting for ESP8266 Env,
then i compile for ESP32 only, thats showing the problem ESP8266WiFi.h: No such file or directory.

Env

[env:esp12e]
; platform = espressif8266
; board = esp12e
; framework = arduino
; monitor_speed = 115200
; upload_speed = 921600
; upload_port = COM4

    [env:esp32]
    platform = espressif32
    framework = arduino
    board = esp32dev
    debug_tool = olimex-arm-usb-ocd-h
    build_flags =
    check_tool = cppcheck, clangtidy
    lib_deps =

The compilation shows a failure in main.cpp line 7, but you’re showing the wrong file. What’s in main.cpp?

After you’ve examined the main.cpp as indicated by maxgerhardt, to make compiling go faster (as every time you edit the platformio.ini there will be a complete rebuild of the entire project rather than just the bits that have been chagned) - there’s no need to comment out the [env:*] you’re not using if you use the specific Build option for that environment under the platformio panel…

image