NO

Author Topic: Compile 32bit exe with Pelles 64bit (Command line)  (Read 3205 times)

rdentato

  • Guest
Compile 32bit exe with Pelles 64bit (Command line)
« on: October 01, 2016, 09:56:41 PM »
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:

Code: [Select]
  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:

Code: [Select]
  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:

Code: [Select]
  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.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Compile 32bit exe with Pelles 64bit (Command line)
« Reply #1 on: October 01, 2016, 11:25:05 PM »
This works for me:
Code: [Select]
"%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

  • Guest
Re: Compile 32bit exe with Pelles 64bit (Command line)
« Reply #2 on: October 02, 2016, 08:31:42 AM »
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

  • Guest
Re: Compile 32bit exe with Pelles 64bit (Command line)
« Reply #3 on: October 02, 2016, 08:52:41 AM »
WORK AROUND::

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

Code: [Select]
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 :)