I created an empty C ++ project in Visual Studio 2012 Express (for the desktop, of course) and added some random base code:
#include <cstdio> #include <cstdlib> typedef struct examplestruct { unsigned char num1; unsigned short num2; unsigned long num3; unsigned long long num4; } EXAMPLESTRUCT; void examplefunction(unsigned long *num, int num2) { *num += num2; return; } int main(int nArgs, char **pszArgs) { EXAMPLESTRUCT ExStructInstance = {0xFF, 0xFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF}; printf("%d, %d, %u, %ull\n", ExStructInstance.num1, ExStructInstance.num2, ExStructInstance.num3, ExStructInstance.num4); unsigned long num5 = ExStructInstance.num1 + ExStructInstance.num2; printf("%d\n", num5); examplefunction(&num5, 10); printf("%d\n", num5); system("pause"); return 0; }
(If you are interested in what this refers to, I will parse the generated executable file to observe the behavior of the optimizing compiler, as well as learn more about the x86 assembly.)
In Linker, in the project settings, I selected Multi-threaded (/MT) for the runtime library, so it statically links it.
I compiled and started debugging with F5 and immediately got this error in the message box:
Runtime Error!
Program: C: \ Users \ xxxxx \ Documents \ P ...
R6030
So, this basic program will not start due to some problems with the runtime library, which I cannot understand!
Any ideas? I just would like to know what is going on here. Thanks in advance!
EDIT: FYI, all this is done in Release mode.