我试图用lcc-win32/wedit用c编写一个简单的hello world程序,我对windows c编程有点不熟悉。
#include <stdio.h>
int main(void){
printf("hellow\n");
return 0;
}当我编译程序时,控制台输出是:
Wedit output window build: Tue Jun 15 09:13:17 2010
c:\lcc\lib\lcccrt0.obj .text: undefined reference to '_RtlUnwind@16'
c:\lcc\lib\lcccrt0.obj .text: undefined reference to '_signal'
c:\lcc\lib\lcccrt0.obj .text: undefined reference to '_raise'
c:\lcc\lib\lcccrt0.obj .text: undefined reference to '_exit'
asctoq.obj .text: undefined reference to '_strnicmp'
defaulttrap.obj .text: undefined reference to '__imp___iob'
defaulttrap.obj .text: undefined reference to '_fwrite'
defaulttrap.obj .text: undefined reference to '_itoa'
defaulttrap.obj .text: undefined reference to '_strcat'
defaulttrap.obj .text: undefined reference to '_MessageBoxA@16'
defaulttrap.obj .text: undefined reference to '_abort'
powlasm.obj .text: undefined reference to '_pow'
qfloat.obj .text: undefined reference to '_memset'
qfloat.obj .text: undefined reference to '_strchr'
qfloat.obj .text: undefined reference to '_memmove'
strlcpy.obj .text: undefined reference to '_memcpy'
xprintf.obj .text: undefined reference to '_localeconv'
xprintf.obj .text: undefined reference to '_strtol'
xprintf.obj .text: undefined reference to '_wcslen'
xprintf.obj .text: undefined reference to '_wctomb'
xprintf.obj .text: undefined reference to '_fputc'
search
Compilation + link time:0.1 sec, Return code: 60当我尝试在wedit中执行该程序时,出现一个对话框,提示"hello.exe不是最新的。是否重新构建?“
如果单击“是”,则不会发生任何操作。如果我单击“否”,将弹出一个dos窗口
"C:\lcc\projects\lcc2\hello.exe“
返回代码-1
执行时间0.001秒
按任意键继续...
无论我编译/重新编译多少次,这种情况都会继续发生。
有什么想法吗?
发布于 2010-06-15 21:50:42
您需要告诉链接器链接C运行时库以及Windows kernel32.lib和user32.lib导入库。后两者需要安装Windows SDK。
您正在使用的编译器非常晦涩难懂。您需要阅读其手册中的小字体,以弄清楚如何正确配置它,以便链接器链接这些库。如果你不能自己解决这个问题,或者找到熟悉这个集成开发环境的人,我建议你下载免费的Microsoft Visual Studio Express C++版本。它负责项目模板中的许多细节,这些模板预置了大量的编译器和链接器设置。您需要Win32控制台应用程序模板。
发布于 2011-03-23 18:49:02
这个问题似乎存在于W7的“微软安全要点”中。问题的解决方法在http://compgroups.net/comp.compilers.lcc/.text-undefined-reference-to上进行了描述。
发布于 2010-06-15 21:39:03
将以下内容添加到页面顶部:
#include <stdio.h>https://stackoverflow.com/questions/3045515
复制相似问题