|
| 1 | +--- |
| 2 | +title: "/JMC (Just My Code debugging) | Microsoft Docs" |
| 3 | +ms.custom: "08/20/2018" |
| 4 | +ms.technology: ["cpp-tools"] |
| 5 | +ms.topic: "reference" |
| 6 | +f1_keywords: ["/JMC"] |
| 7 | +dev_langs: ["C++"] |
| 8 | +helpviewer_keywords: ["/JMC compiler option [C++]", "Just my code [C++]", "-JMC compiler option [C++]", "User code, debugging", "JMC compiler option [C++]"] |
| 9 | +author: "corob-msft" |
| 10 | +ms.author: "corob" |
| 11 | +ms.workload: ["cplusplus"] |
| 12 | +--- |
| 13 | +# /JMC (Just My Code debugging) |
| 14 | + |
| 15 | +Specifies compiler support for native *Just My Code* debugging in the Visual Studio debugger. This option allows Visual Studio to automatically step over system, framework, library, and other non-user calls, and to collapse those calls in the call stack window. The **/JMC** compiler option is available starting in Visual Studio 2017 version 15.8. |
| 16 | + |
| 17 | +## Syntax |
| 18 | + |
| 19 | +> **/JMC**\[**-**] |
| 20 | +
|
| 21 | +## Remarks |
| 22 | + |
| 23 | +The Visual Studio [Just My Code](/visualstudio/debugger/just-my-code) option allows the Visual Studio debugger to step over system, framework, library, and other non-user calls. The **/JMC** compiler option enables support for Just My Code debugging in your native C++ code. When **/JMC** is enabled, the compiler inserts calls to a helper function, `__CheckForDebuggerJustMyCode`, in the function prolog. The Visual Studio debugger uses this information to check whether the debugger step operation should skip this function call. To enable Just My Code in the Visual Studio debugger, on the menu bar, choose **Tools** > **Options**, and then set the option in **Debugging** > **General** > **Enable Just My Code**. |
| 24 | + |
| 25 | +The Just My Code feature requires that your code links to the Universal C Runtime Library (CRT) by use of the [/MT, /MTd, /MD, or /MDd](md-mt-ld-use-run-time-library.md) compiler option, or the [/DEFAULTLIB](defaultlib-specify-default-library.md) linker option. If you project does not link to the CRT, you may see linker error **LNK2019: unresolved external symbol __CheckForDebuggerJustMyCode**. To resolve this error, either link to the CRT, or disable the **/JMC** option. |
| 26 | + |
| 27 | +By default, the **/JMC** compiler option is off. However, starting in Visual Studio 2017 version 15.8 this option is enabled in most Visual Studio project templates. To explicitly disable this option, use the **/JMC-** option on the command line. In Visual Studio, open the project Property Pages dialog box, and change the **Support Just My Code Debugging** property in the **Configuration Properties** > **C/C++** > **General** property page to **No**. |
| 28 | + |
| 29 | +For more information, see [C++ Just My Code](/visualstudio/debugger/just-my-code#BKMK_C___Just_My_Code) in [Specify whether to debug only user code using Just My Code in Visual Studio](/visualstudio/debugger/just-my-code), and the Visual C++ Team Blog post [Announcing C++ Just My Code Stepping in Visual Studio](https://blogs.msdn.microsoft.com/vcblog/2018/06/29/announcing-jmc-stepping-in-visual-studio/). |
| 30 | + |
| 31 | +### To set this compiler option in the Visual Studio development environment |
| 32 | + |
| 33 | +1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md). |
| 34 | + |
| 35 | +1. Select the **Configuration Properties** > **C/C++** > **General** property page. |
| 36 | + |
| 37 | +1. Modify the **Support Just My Code Debugging** property. |
| 38 | + |
| 39 | +### To set this compiler option programmatically |
| 40 | + |
| 41 | +- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>. |
| 42 | + |
| 43 | +## See Also |
| 44 | + |
| 45 | +[Compiler Options](../../build/reference/compiler-options.md)<br/> |
| 46 | +[Setting Compiler Options](../../build/reference/setting-compiler-options.md)<br/> |
0 commit comments