Compile 32bit exe with Pelles 64bit (Command line)

Started by rdentato, October 01, 2016, 09:56:41 PM

Previous topic - Next topic

rdentato

I'm using Pelles C 8.00 64bit and I want to generate a 32bit version and a 64bit version of my program.

For the 64bit executable there is no problem: I open the "Pelles C Command Prompt (64 bit)" command window and give the command:


  cc myprog.c /omyprog64.exe



To create the 32bit version, I thought I could do the same by opening the "Pelles C Command Prompt" window.
Unfortunately, using the command:


  cc myprog.c /omyprog32.exe


I get a lot of error messages from the linker like:

POLINK: error: Unresolved external symbol '__imp__CloseHandle@4'.
...


Based on what I've found on this forum I've tried many different variation of the command:


  cc -Tx86-coff myprog.c  /LIBPATH:"%PellesCDir%\lib\win" /omyprog32.exe


but none seems to work.

Basically, it's similar to this question: http://forum.pellesc.de/index.php?topic=5151.0 but the other way around.

Is there anything else I can try?

Thanks.

TimoVJL

This works for me:"%PellesCDir%\bin\cc" -Ze -Tx86-coff test.c /LIBPATH:"%PellesCDir%\lib\win" /otest32.exe
"%PellesCDir%\bin\cc" -Ze -Tx64-coff test.c /LIBPATH:"%PellesCDir%\lib\win64" /otest64.exe
pause
check that PellesCDir variable.
May the source be with you

rdentato

Thanks TimoVJL.

  Same result :(.  The %PellesCDir% variable is correct.

  I wonder if I had made any mistake in the installation.

  From the download page I took the "Setup, 64-bit edition" version installer and accepted the default options (except for the directory, I installed in "C:\pelles" to avoid the space in the path).

  I'm wondering if I miss any DLL (or similar) on the Windows side. I'm on WIn10 64bit.

 

rdentato

WORK AROUND::

I made it work by explicitly linking the kernel32.lib library. I had to specify the full path:


cc -Tx86-coff myprog.c  /LIBPATH:"%PellesCDir%\lib\win" "%PellesCDir%\lib\win\kernel32.lib" /omyprog32.exe


Hope this can help anyone with the same problem :)