I created an empty C++ project in Visual Studio 2012 Express (for Desktop of course), and added some random basic 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're wondering what the hell this is about, I'm disassembling the created executable file to observe the behaviour of the optimizing compiler, and also to learn more about x86 assembly.)
Under Linker in the project settings, I selected Multi-threaded (/MT)
for the runtime library, so it would statically link it.
I compiled and started debugging with F5 and immediately got this error in a message box:
Runtime Error!
Program: C:\Users\xxxxx\Documents\P...
R6030
- CRT not initialized
So, this basic program won't run due to some problem with the runtime library, which I can't figure out!
Any ideas? I'd just like to know what's going on here. Thanks in advance!
EDIT: FYI, this is all done in Release mode.