Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
'var' has different type in 'file1' and 'file2': 'type1' and 'type2'
Remarks
An external variable referenced or defined in two files has different types in those files. To resolve, either make the type definitions the same, or change variable name in one of the files.
C4744 is emitted only when files are compiled with /GL. For more information, see /GL (Whole Program Optimization).
Note
C4744 usually occurs in C (not C++) files, because in C++ a variable name is decorated with type information. When the example (below) is compiles as C++, you'll get linker error LNK2019.
Example
This example contains the first definition.
// C4744.c
// compile with: /c /GL
int global;
The following example generates C4744.
// C4744b.c
// compile with: C4744.c /GL /W1
// C4744 expected
#include <stdio.h>
extern unsigned global;
int main()
{
printf_s("%d\n", global);
}