Hey all. When I try to build clink on visual studio 2019, I get the following error:
1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(165,30): error C2220: the following warning is treated as an error
1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(165,30): warning C4838: conversion from 'int' to 'SHORT' requires a narrowing conversion
1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(165,51): warning C4838: conversion from 'int' to 'SHORT' requires a narrowing conversion
1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(176,14): warning C4838: conversion from 'A' to 'SHORT' requires a narrowing conversion
Since warnings are treated like errors, the compilation fails for other projects that depend on clink_terminal (name of project in VS) fail also. There is an option to ignore warnings which when toggled the entire solution builds.
The easy solution seems to be casting the offending variables to the correct narrower types. An example:
Hey all. When I try to build clink on visual studio 2019, I get the following error: 1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(165,30): error C2220: the following warning is treated as an error 1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(165,30): warning C4838: conversion from 'int' to 'SHORT' requires a narrowing conversion 1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(165,51): warning C4838: conversion from 'int' to 'SHORT' requires a narrowing conversion 1>C:\Users\justin\source\repos\clink\clink\terminal\src\win_screen_buffer.cpp(176,14): warning C4838: conversion from 'A' to 'SHORT' requires a narrowing conversion
Since warnings are treated like errors, the compilation fails for other projects that depend on clink_terminal (name of project in VS) fail also. There is an option to ignore warnings which when toggled the entire solution builds.
The easy solution seems to be casting the offending variables to the correct narrower types. An example:
//compile error COORD xy = { window.Left + column, window.Top + row };
//no compile error COORD xy = { window.Left + (SHORT)column, window.Top + (SHORT)row };
//For context the def of CORD is typedef struct _COORD { SHORT X; SHORT Y; } COORD, *PCOORD;