MSVC docker container running error

Shim, chanhuyng 1 Reputation point
2021-03-12T01:07:03.787+00:00

I am beginner with Visual Studio, Build Tools and Docker.
I was following this link :
https://devblogs.microsoft.com/cppblog/using-msvc-in-a-docker-container-for-your-c-projects/

I confirmed project using visual studio compiler image and building solution perfectly, but I'm seeing problem with actually running generated .exe file in docker container environment.

Following is the output :

Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 3/11/2021 7:55:55 PM.
Project "C:\ConsoleApplication1\Project4.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|x64".
Project "C:\ConsoleApplication1\Project4.sln" (1) is building "C:\ConsoleApplication1\Project4.vcxproj" (2) on node 1 (default targets).
InitializeBuildStatus:
  Creating "x64\Debug\Project4.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe /c /IC:\ConsoleApplication1\Include /Z7 /JMC /nologo /W3 /WX- /diagnostics:classic /sdl /Od /D _MBCS /Gm- /EHsc /RTC1 /MD /GS /fp:precise /permissive- /Zc:wcha
  r_t /Zc:forScope /Zc:inline /Fo"x64\Debug\\" /Fd"x64\Debug\vc141.pdb" /Gd /TC /FC /errorReport:queue log.c main.c NiFpga.c NiFpga_RealTimeEffectsEngine.c NiFpga_Streaming_FPGA.c ReadDataSentToATCA.c SMARTS_RF_Subsystem.c S
  MARTS_RTEE_Subsystem.c
  log.c
c:\consoleapplication1\log.c(135): warning C4047: '=': 'tm *' differs in levels of indirection from 'errno_t' [C:\ConsoleApplication1\Project4.vcxproj]
  main.c
c:\consoleapplication1\main.c(29): warning C4047: '=': 'NiFpga_Session' differs in levels of indirection from 'void *' [C:\ConsoleApplication1\Project4.vcxproj]
c:\consoleapplication1\main.c(30): warning C4047: '=': 'NiFpga_Status' differs in levels of indirection from 'void *' [C:\ConsoleApplication1\Project4.vcxproj]
  NiFpga.c
  NiFpga_RealTimeEffectsEngine.c
  NiFpga_Streaming_FPGA.c
  ReadDataSentToATCA.c
c:\consoleapplication1\readdatasenttoatca.c(9): warning C4133: 'initializing': incompatible types - from 'smarts_rtee_subsystem_type *' to 'smarts_rtee_subsystem_type *' [C:\ConsoleApplication1\Project4.vcxproj]
c:\consoleapplication1\readdatasenttoatca.c(96): warning C4133: 'initializing': incompatible types - from 'smarts_rtee_subsystem_type *' to 'smarts_rtee_subsystem_type *' [C:\ConsoleApplication1\Project4.vcxproj]
  SMARTS_RF_Subsystem.c
  SMARTS_RTEE_Subsystem.c
c:\consoleapplication1\smarts_rtee_subsystem.c(7): warning C4013: 'printf' undefined; assuming extern returning int [C:\ConsoleApplication1\Project4.vcxproj]
  Generating Code...
Link:
  C:\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\ConsoleApplication1\x64\Debug\Project4.exe" /INCREMENTAL /NOLOGO /LIBPATH:C:\ConsoleApplication1\lib kernel32.lib user32.lib gdi3
  2.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib niRFSA.lib niRFSG.lib legacy_stdio_definitions.lib nistreaming.lib kernel32.lib user32.lib gdi32.lib winspool
  .lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\ConsoleApplication1\x6
  4\Debug\Project4.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\ConsoleApplication1\x64\Debug\Project4.lib" /MACHINE:X64 x64\Debug\log.obj
  x64\Debug\main.obj
  x64\Debug\NiFpga.obj
  x64\Debug\NiFpga_RealTimeEffectsEngine.obj
  x64\Debug\NiFpga_Streaming_FPGA.obj
  x64\Debug\ReadDataSentToATCA.obj
  x64\Debug\SMARTS_RF_Subsystem.obj
  x64\Debug\SMARTS_RTEE_Subsystem.obj
  Project4.vcxproj -> C:\ConsoleApplication1\x64\Debug\Project4.exe
FinalizeBuildStatus:
  Deleting file "x64\Debug\Project4.tlog\unsuccessfulbuild".
  Touching "x64\Debug\Project4.tlog\Project4.lastbuildstate".
Done Building Project "C:\ConsoleApplication1\Project4.vcxproj" (default targets).

Done Building Project "C:\ConsoleApplication1\Project4.sln" (default targets).


Build succeeded.

(ClCompile target) ->
  c:\consoleapplication1\log.c(135): warning C4047: '=': 'tm *' differs in levels of indirection from 'errno_t' [C:\ConsoleApplication1\Project4.vcxproj]
  c:\consoleapplication1\main.c(29): warning C4047: '=': 'NiFpga_Session' differs in levels of indirection from 'void *' [C:\ConsoleApplication1\Project4.vcxproj]
  c:\consoleapplication1\main.c(30): warning C4047: '=': 'NiFpga_Status' differs in levels of indirection from 'void *' [C:\ConsoleApplication1\Project4.vcxproj]
  c:\consoleapplication1\readdatasenttoatca.c(9): warning C4133: 'initializing': incompatible types - from 'smarts_rtee_subsystem_type *' to 'smarts_rtee_subsystem_type *' [C:\ConsoleApplication1\Project4.vcxproj]
  c:\consoleapplication1\readdatasenttoatca.c(96): warning C4133: 'initializing': incompatible types - from 'smarts_rtee_subsystem_type *' to 'smarts_rtee_subsystem_type *' [C:\ConsoleApplication1\Project4.vcxproj]
  c:\consoleapplication1\smarts_rtee_subsystem.c(7): warning C4013: 'printf' undefined; assuming extern returning int [C:\ConsoleApplication1\Project4.vcxproj]

    6 Warning(s)
    0 Error(s)

After building, it instantly terminated without printing out program output. Instead, I tried going into docker environment and running .exe by myself.
and following is output :

C:\smarts-pxie-executive\x64\Debug>Project4.exe
C:\smarts-pxie-executive\x64\Debug>

It didn't printout without any error messages. It works perfectly fine when I opened .exe file on local computer. I can't really know how I should resolve problem since there isn't any error message that I can see.

Can anyone please advise me? I'm really desperate

Thanks in advance.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
1,183 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
3,191 questions
Microsoft Build
Microsoft Build
A Microsoft platform for building applications with Visual Studio and .NET on Windows.
402 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,381 Reputation points
    2021-03-12T03:32:55.11+00:00

    Hi Shimchanhuyng,

    I found a similar issue about running executable file in Windows Docker Container.

    Since it is not supported in Microsoft Q&A forum, we suggest you report it in stack overflow with docker-for-windows tag or docker forum.

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments