I got the same problem in my fpcdeluxe lazarus installation. Whenever I set the project options to win32 build mode, it complained about lacking a valid fpc.cfg file and threw
Error: Illegal parameter: -TWIN32
when compiling the project.
Thanks for your help. I just want to add for those (like me) that are not skilled programmers that in order to fix it within Lazarus, the solution is the same, and we do it by setting the 'Target OS' and 'Target CPU family' parameters in Project-->Project Options-->Config and Target. I set them to Win32 and i386, respectively and works fine (needless to say I didn't need any extra optimization for such project).