Following this question, I am trying to compile the code below:
// main.cpp
#include <iostream>
int main(int argc, char **argv)
{
unsigned long long myVar;
__security_init_cookie();
myVar = __scrt_initialize_crt(1);
return 0;
}
in the command line cl main.cpp
but I get the error message
Microsoft (R) C/C++ Optimizing Compiler Version 19.31.31104 for x64 Copyright (C) Microsoft Corporation. All rights reserved. main.cpp main.cpp(12): error C3861: '__scrt_initialize_crt': identifier not found
while the equivalent C code
// main.c
#include <stdio.h>
int main(int argc, char **argv)
{
unsigned long long myVar;
__security_init_cookie();
myVar = __scrt_initialize_crt(1);
return 0;
}
works just fine. I would appreciate it if you could help me understand what the problem is and how I can rewrite the C code in pure and canonical C++.