You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/porting/floating-point-migration-issues.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.author: "corob"
11
11
ms.workload: ["cplusplus"]
12
12
---
13
13
# Floating-point migration issues
14
+
14
15
15
16
Sometimes when you upgrade your projects to a newer version of Visual Studio, you may find that the results of certain floating-point operations have changed. This generally happens for one of two reasons: Code generation changes that take better advantage of the available processor, and bug fixes or changes to the algorithms used in math functions in the C runtime library (CRT). In general, the new results are correct to within the limits specified by the language standard. Read on to find out what's changed, and if it's important, how to get the same results your functions got before.
16
17
@@ -32,6 +33,6 @@ In most cases, the floating-point changes in the newest compilers and libraries
32
33
33
34
## See also
34
35
35
-
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)
36
-
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)
36
+
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)<br/>
37
+
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)<br/>
37
38
[Visual C++ change history 2003 - 2015](visual-cpp-change-history-2003-2015.md)
Copy file name to clipboardExpand all lines: docs/porting/porting-and-upgrading-examples-and-case-studies.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
11
11
ms.workload: ["cplusplus"]
12
12
---
13
13
# Porting and Upgrading: Examples and Case Studies
14
+
14
15
You can get an idea of the kinds of issues you might encounter duration a migration from a previous version of Visual C++ to the current one by reviewing stories of successful migrations.
Copy file name to clipboardExpand all lines: docs/porting/porting-guide-com-spy.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
11
11
ms.workload: ["cplusplus"]
12
12
---
13
13
# Porting Guide: COM Spy
14
+
14
15
This topic is the second in a series of articles that demonstrates the process of upgrading older Visual C++ projects to the latest version of Visual Studio. The example code in this topic was last compiled with Visual Studio 2005.
15
16
16
17
## COMSpy
@@ -166,6 +167,6 @@ This ran without problems, and with COM Spy up and running and configured to mon
166
167
167
168
## See Also
168
169
169
-
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)
Copy file name to clipboardExpand all lines: docs/porting/porting-guide-mfc-scribble.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
11
11
ms.workload: ["cplusplus"]
12
12
---
13
13
# Porting Guide: MFC Scribble
14
+
14
15
This topic is the first of several topics that introduce you to the upgrade procedure for Visual C++ projects that were created in older versions of Visual Studio to Visual Studio 2017. These topics introduce the upgrade process by example, starting with a very simple project and moving to slightly more complex ones. In this topic, we work through the upgrade process for a specific project, MFC Scribble. It is suitable as a basic introduction to the upgrade process for C++ projects.
15
16
16
17
Each version of Visual Studio introduces possible incompatibilities that can complicate moving code from an older version of Visual Studio to a newer one. Sometimes the required changes are in your code, so you must recompile and update your code, and sometimes the required changes are to the project files. When you open a project that was created with a previous version of Visual Studio, Visual Studio automatically asks you whether to update a project or solution to the latest version. These tools usually upgrade only the project files; they do not modify your source code.
@@ -28,6 +29,7 @@ Finally, we needed to decide on the specific method of upgrade. For more complex
28
29
Note that you can also run devenv at the command line, using the `/Upgrade` option, instead of using the wizard to upgrade your projects. See [/Upgrade (devenv.exe)](/visualstudio/ide/reference/upgrade-devenv-exe). That could be helpful in automating the upgrade process for a large number of projects.
29
30
30
31
### Step 1. Converting the Project File
32
+
31
33
When you open an old project file in Visual Studio 2017, Visual Studio offers to convert the project file to the most recent version, which we accepted. The following dialog box appeared:
32
34
33
35

@@ -47,6 +49,7 @@ Visual Studio then displayed a migration report listing all of the issues with t
47
49
In this case, the issues were all warnings, and Visual Studio made the appropriate changes in the project file. The big difference as far as the project is concerned is that the build tool changed from vcbuild to msbuild. This change was first introduced in Visual Studio 2010. Other changes include some rearrangement of the sequence of elements in the project file itself. None of the issues required further attention for this simple project.
48
50
49
51
### Step 2. Getting it to build
52
+
50
53
Before building, we check the platform toolset so we know what compiler version the project system is using. In the project properties dialog, under **Configuration Properties**, in the **General** category, look at the **Platform Toolset** property. It contains the version of Visual Studio and the platform tool version number, which in this case is v141 for the Visual Studio 2017 version of the tools. When you convert a project that was originally compiled with Visual C++ 2010, 2012, 2013 or 2015, the toolset is not automatically updated to the Visual Studio 2017 toolset.
51
54
52
55
To make the switch to Unicode, open the project's properties, under **Configuration Properties**, choose the **General** section, and locate the **Character Set** property. Change this from **Use Multi-Byte Character Set** to **Use Unicode Character Set**. The effect of this change is that now the _UNICODE and UNICODE macros are defined and _MBCS is not, which you can verify in the properties dialog under the **C/C++** category at the **Command Line** property.
@@ -63,18 +66,20 @@ Now build the solution. In the output window, the compiler tells us that _WINNT3
63
66
_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
64
67
```
65
68
66
-
This is a warning, not an error, and is very common when upgrading a Visual C++ project. This is the macro that defines what the lowest version of Windows that our application will run on. If we ignore the warning, we accept the default value, _WIN32_WINNT_MAXVER, which means the current version of Windows. For a table of possible values, see [Using the Windows Headers](/windows/desktop/WinProg/using-the-windows-headers). For example, we can set it to run on any version from Vista onwards.
69
+
This is a warning, not an error, and is very common when upgrading a Visual C++ project. This is the macro that defines what the lowest version of Windows that our application will run on. If we ignore the warning, we accept the default value, _WIN32_WINNT_MAXVER, which means the current version of Windows. For a table of possible values, see [Using the Windows Headers](/windows/desktop/WinProg/using-the-windows-headers). For example, we can set it to run on any version from Vista onwards.
67
70
68
-
```
71
+
```cpp
69
72
#define_WIN32_WINNT_WIN32_WINNT_VISTA
70
73
```
71
74
72
75
If the code uses parts of the Windows API that aren't available on the version of Windows that you specify with this macro, you should see that as a compiler error. In the case of the Scribble code, there is no error.
73
76
74
77
### Step 3. Testing and debugging
78
+
75
79
There is no test suite, so we just started the app, tested its features manually through the UI. No issues were observed.
76
80
77
81
### Step 4. Improve the code
82
+
78
83
Now that you've migrated to Visual Studio 2017, you might want to make some changes to take advantage of new C++ features. The current version of the C++ compiler is much more conformant to the C++ standard then previous versions, so if you have a mind to make some code changes to make your code more secure, and more portable to other compilers and operating systems, you should consider some improvements.
79
84
80
85
## Next steps
@@ -83,5 +88,5 @@ Scribble was a small and simple Windows desktop application, and it wasn't hard
83
88
84
89
## See Also
85
90
86
-
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)
91
+
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)<br/>
87
92
[Next Example: COM Spy](../porting/porting-guide-com-spy.md)
Copy file name to clipboardExpand all lines: docs/porting/porting-guide-spy-increment.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
11
11
ms.workload: ["cplusplus"]
12
12
---
13
13
# Porting Guide: Spy++
14
+
14
15
This porting case study is designed to give you an idea of what a typical porting project is like, the types of problems you might encounter, and some general tips and tricks for addressing porting problems. It's not meant to be a definitive guide to porting, since the experience of porting a project depends very much on the specifics of the code.
15
16
16
17
## Spy++
@@ -65,7 +66,7 @@ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afxv_w32.h
65
66
66
67
Windows XP is no longer supported by Microsoft, so even though targeting it is allowed in Visual Studio 2015, you should be phasing out support for it in your applications, and encouraging your users to adopt new versions of Windows.
67
68
68
-
To get rid of the error, define WINVER by updating the **Project Properties** setting to the lowest version of Windows you currently want to target. Find a table of values for various Windows releases [here](/windows/desktop/WinProg/using-the-windows-headers).
69
+
To get rid of the error, define WINVER by updating the **Project Properties** setting to the lowest version of Windows you currently want to target. Find a table of values for various Windows releases [here](/windows/desktop/WinProg/using-the-windows-headers).
69
70
70
71
The stdafx.h file contained some of these macro definitions.
The _T macro has the effect of making a string literal compile as a **char** string or a **wchar_t** string, depending on the setting of MBCS or UNICODE. To replace all strings with _T in Visual Studio, first open the **Quick Replace** (Keyboard: **Ctrl**+**F**) box or the **Replace In Files** (Keyboard: **Ctrl**+**Shift**+**H**), then choose the **Use Regular Expressions** checkbox. Enter `((\".*?\")|('.+?'))` as the search text and `_T($1)` as the replacement text. If you already have the _T macro around some strings, this procedure will add it again, and it might also find cases where you don't want _T, such as when you use `#include`, so it's best to use **Replace Next** rather than **Replace All**.
544
545
545
-
This particular function, [wsprintf](/windows/desktop/api/winuser/nf-winuser-wsprintfa), is actually defined in the Windows headers, and the documentation for it recommends that it not be used, due to possible buffer overrun. No size is given for the `szTmp` buffer, so there is no way for the function to check that the buffer can hold all the data to be written to it. See the next section about porting to the Secure CRT, in which we fix other similar problems. We ended up replacing it with [_stprintf_s](../c-runtime-library/reference/sprintf-s-sprintf-s-l-swprintf-s-swprintf-s-l.md).
546
+
This particular function, [wsprintf](/windows/desktop/api/winuser/nf-winuser-wsprintfa), is actually defined in the Windows headers, and the documentation for it recommends that it not be used, due to possible buffer overrun. No size is given for the `szTmp` buffer, so there is no way for the function to check that the buffer can hold all the data to be written to it. See the next section about porting to the Secure CRT, in which we fix other similar problems. We ended up replacing it with [_stprintf_s](../c-runtime-library/reference/sprintf-s-sprintf-s-l-swprintf-s-swprintf-s-l.md).
546
547
547
548
Another common error you’ll see in converting to Unicode is this.
548
549
@@ -671,5 +672,5 @@ Porting Spy++ from the original Visual C++ 6.0 code to the latest compiler took
671
672
672
673
## See Also
673
674
674
-
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)
675
+
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)<br/>
675
676
[Previous case study: COM Spy](../porting/porting-guide-com-spy.md)
Copy file name to clipboardExpand all lines: docs/porting/upgrading-projects-from-earlier-versions-of-visual-cpp.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus"]
13
13
---
14
14
# Upgrading Projects from Earlier Versions of Visual C++
15
+
15
16
In most cases, you can open a project that was created in an earlier version of Visual Studio. However, to accomplish this, Visual Studio upgrades the project. If you save this upgraded project, it cannot be opened in the earlier version.
16
17
17
18
> [!IMPORTANT]
@@ -33,7 +34,7 @@ For information about how to update the targeted Windows versions, see [Modifyin
33
34
34
35
## See Also
35
36
36
-
[Build System Changes](../build/build-system-changes.md)
37
-
[What's New for Visual C++ in Visual Studio 2017](../what-s-new-for-visual-cpp-in-visual-studio.md)
38
-
[Visual C++ change history 2003 - 2015](../porting/visual-cpp-change-history-2003-2015.md)
37
+
[Build System Changes](../build/build-system-changes.md)<br/>
38
+
[What's New for Visual C++ in Visual Studio 2017](../what-s-new-for-visual-cpp-in-visual-studio.md)<br/>
39
+
[Visual C++ change history 2003 - 2015](../porting/visual-cpp-change-history-2003-2015.md)<br/>
0 commit comments