Author Topic: Extra comma before first .obj file when using comma as object separator  (Read 345 times)

Offline adalbert

  • Single posting newcomer
  • *
  • Posts: 1
I am trying to use some vintage compilers with C::B, and I noticed that there is an issue that prevents me from having a successful build using OpenWatcom 1.9 compiler. It needs a comma-separated linkable object list, so I am using "," as object separator in Advanced Compiler Options. This is also the default setting in built-in compiler preset for Open Watcom (WIN32).

But this is a resulting linking command:

wlink.exe option quiet system nt_win  LIBP  C:\Dev\wxMSW-2.8.12\lib\wat_lib\msw;C:\dev\watcom\lib386;C:\dev\watcom\lib386\nt file ,obj\Release\wx28test1App.obj,obj\Release\wx28test1Main.obj name bin\Release\wx28test1.exe library

$link_objects macro is expanded to ,obj\Release\wx28test1App.obj,obj\Release\wx28test1Main.obj

which has an unnecessary comma in the beginning, and causes build error (Error! E3033: directive error near 'file')
This happens in a default project template for wxWidgets.

I wonder why this issue is caused and is it possible to adjust some settings so it won't happen. Maybe there is an empty file included in the list of linkable objects or something like that, but I don't know how to check it.

It happens both with 12 Aug 2022 nightly version and 20.03 stable.

---  update: ---

It turns out, that extra comma is added when resource.rc file is marked to be linked (which by default is, and should be). When I unchecked linking (Projects -> resource.rc -> right click - options - deselect Link file) the comma disappeared. However I still need the resource file to be linked, so I made a following workaround:

I modified executable linking command in Advanced Compiler Option in such a way:

$linker option quiet $link_options $libdirs file $link_objects name $exe_output $libs $link_resobjects

$linker option quiet $link_options $libdirs file $link_objects name $exe_output $libs resource $objects_output_dirresource.res

and removed resource.res from linking. It still is being linked, because it is now hardcoded in the linking command. Not the best solution, but it works for now.
« Last Edit: August 19, 2022, 06:46:31 pm by adalbert »