Author Topic: Microsoft Community 2022 cl.exe compiler can't find source file name redux  (Read 1770 times)

Offline blocky

  • Single posting newcomer
  • *
  • Posts: 1
I know  this has come up before, but I didn't see a resolution. Forum rules claim that if the compiler has problems,  don't bother the codeblocks forum about it. However, I think I need to know where, and how codeblocks builds the command line arguments to cl.exe. It seems that the Microsoft cl.exe from Community Edition 2022 needs a different command line argument presentation than the 2010 compiler, which is the last Microsoft compiler supported in Codeblocks. I used advise on this forum to redirect Codeblocks into using the paths for Community 2022, after selecting Microsoft 2010 in the drop down list.  This is the build log:

cl.exe /nologo /W3 /EHsc  /Zi /D_DEBUG /MDd  /TP /GA   /I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\Hostx64\x64" /I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include" /I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin" /I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\" /IC:\Users\stan\Documents\codeblocks\new2 /c main.cpp /Foobj\Debug\main.obj
link.exe /nologo /LIBPATH:"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\lib" /out:bin\Debug\new2.exe msvcrtd.lib msvcprtd.lib obj\Debug\main.obj  /DEBUG
cl : Command line error D8003 : missing source filename
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I do hope I'm not blown off with "USE THE 2010 COMPILER!"



Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Microsoft Community 2022 cl.exe compiler can't find source file name redux
« Reply #1 on: February 09, 2022, 07:04:38 am »
A source code snapshot can be downloaded from the following page or if you know SVN then you can use SVN to grab the source:
https://sourceforge.net/p/codeblocks/code/HEAD/tree/

The file you want to start looking at is the following as you indicated you selected the MS 2010 compiler:
    src\plugins\compilergcc\compilerMSVC10.cpp
Sorry, but I have not used or looked the MS VS compilers yet as I am frying other PC compiler issues and processes.

If you do want to update the code to support VS2022 CE then I would suggest the following as a starting point:1) Grab the latest code via SVN2) Copy the SVN code into a working directory.3) Setup MSYS2 Mingw64
4) Build wxWidgets as per the following page:     https://wiki.codeblocks.org/index.php/Compiling_wxWidgets_3.0.0_to_develop_Code::Blocks_(MSW)
5) Attached is my latest instructions that I use for building on Windows with MSYS2. If you get stuck or cannot follow it have a look at the following page as it has pics on it and may be of use:    https://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Windows   If you find issues with the attached doc please let me know so I can update it as eventtually I will update the wiki page with the info in it.    Just spotted that my instructions do not include a global variable section. Something for the future.6) Once you have a working C::B build then copy the compilerMSVC10.cpp/h to say compilerMSVS2022.cpp/h and start modifying to get it working.
7) Once you have a working compiler please create a ticket on the following page for updating the compiler plugin to support VS2022 and attach the files (okay strictly speaking you should create a patch file, but I would like to test it first and check the code and as such attaching the files is easier and I will create a patch).
      https://sourceforge.net/p/codeblocks/tickets/

If you get stuck building wxWidgets or C::B do not hesitate to ask as I have batch files I use that build wxWidgets and C::B and also clean the source tree so it is back to as close as I can to a pristine condition just like the SVN code looks like as clean still leaves some intermediate files.

Offline sodev

  • Regular
  • ***
  • Posts: 470
Re: Microsoft Community 2022 cl.exe compiler can't find source file name redux
« Reply #2 on: February 09, 2022, 04:47:24 pm »
Highly unlikely that the command line format has changed, much more likely you are affected by the trailing slash issue since one of your include paths ends with one.