VERY simple C program won't compile with VC 64

Posted by Paperflyer on Stack Overflow See other posts from Stack Overflow or by Paperflyer
Published on 2010-03-30T20:13:15Z Indexed on 2010/03/30 20:23 UTC
Read the original article Hit count: 378

Filed under:
|
|
|

Here is a very simple C program:

#include <stdio.h>

int main (int argc, char *argv[]) {

    printf("sizeof(short) = %d\n",(int)sizeof(short));
    printf("sizeof(int) = %d\n",(int)sizeof(int));
    printf("sizeof(long) = %d\n",(int)sizeof(long));
    printf("sizeof(long long) = %d\n",(int)sizeof(long long));
    printf("sizeof(float) = %d\n",(int)sizeof(float));
    printf("sizeof(double) = %d\n",(int)sizeof(double));

    return 0;
}

While it compiles fine on Win32 (command line: cl main.c), it does not using the Win64 compiler ("c:\Program Files(x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe" main.c). Specifically, it sais "error LNK2019: unresolved external symbol printf referenced in function main". As far as I understand this, it can not link to printf, right?

Obviously, I have Microsoft Visual C++ Compiler 2008 (Standard enu) x86 and x64 installed and am using the 64-bit flavor of Windows (7).

What is the problem here?

© Stack Overflow or respective owner

Related posts about compiler

Related posts about visual-studio-2008