[英]visual studio express 2012 simple c program fatal error LNK1561: entry point must be defined
While compiling and linking the following simple test.c using: cl.exe test.c in windows 7 console: 在Windows 7控制台中使用cl.exe test.c编译和链接以下简单的test.c时:
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char* args[]){
int i;
i=0;
printf("i=%d",i);
return 0;
}
I got LINK : fatal error LNK1561: entry point must be defined. 我得到了LINK:致命错误LNK1561:必须定义入口点。 It compiles without problem, but failed in linking.
它编译没有问题,但链接失败。 Also if I change the filename to test.cpp then it works fine.
另外,如果我将文件名更改为test.cpp,那么它可以正常工作。 Any idea?
任何想法?
I copied your code and compiled it with cl.exe test.c
and it worked fine. 我复制了您的代码,并使用
cl.exe test.c
对其进行了编译,效果很好。 I think you have a configuration problem. 我认为您有配置问题。
First off, are you using the Visual Studio command line environment? 首先,您正在使用Visual Studio命令行环境吗? Ensure that by typing on a command line:
通过在命令行上输入来确保:
vsvars32
Then try using: 然后尝试使用:
cl.exe test.c kernel32.lib
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.