You’ll find the answer here Convert Arduino file to C++ manually — PlatformIO latest documentation
Please use pre-formatted text when posting code or log files.
Also post the error log or at least describe the error you receive.
This will make it easier to help you.