在pelles c windows中,h不';不编译
我用的是pelles c。当我编译此代码时:在pelles c windows中,h不';不编译,c,header-files,pelles-c,C,Header Files,Pelles C,我用的是pelles c。当我编译此代码时: #include <windows.h> #include <stdio.h> void main(void) { printf("Hello World"); } 谢谢您的帮助。您缺少了一些其他编译器(如Visual Studio)经常定义的#defines。它们提供有关处理器体系结构、操作系统版本、SDK版本等的基本信息 最好查阅Microsoft文档,了解他们的编译器定义了哪些宏,并执行相同的操作 这可能是一个
#include <windows.h>
#include <stdio.h>
void main(void)
{
printf("Hello World");
}
谢谢您的帮助。您缺少了一些其他编译器(如Visual Studio)经常定义的#define
s。它们提供有关处理器体系结构、操作系统版本、SDK版本等的基本信息
最好查阅Microsoft文档,了解他们的编译器定义了哪些宏,并执行相同的操作
这可能是一个很好的起点。要在
PellesC
中使用windows.h
,您必须转到:
- 项目->项目选项->编译器
- 选中:启用Microsoft扩展
intmain(void)
而不是void main(void)
return(0)的return语句代码>就在最后一个括号之前。您必须包含此项,否则将出现语法错误,因为您的程序不知道何时停止运行
项目
,然后向下滚动并选择“项目选项”编译器
选项卡,并确保选择了调用conv:
框链接器
选项卡,确保在子系统
框中将类型设置为控制台
再次尝试构建它,看看会发生什么 删除
#包括并重新编译。是否发生相同的错误?是的,它将编译,但我想使用windows。h@nima,目的何在?需要时包括头文件。我的目的是将光标放在屏幕上的不同位置,并在那里放置一些字符。我找到的解决方案使用windows.h。你能帮我一下吗。windows.h
包含与windows API相关的函数名。这与屏幕位置无关。只有第三项可能是正确的(我不知道)。不过我知道你的1和2是错的。您当然可以使用voidmain(void)
,如果这样做,则根本不需要return[int]
语句;程序什么时候退出?简单:退出函数末尾的main
时。
D:\Program Files\PellesC\Include\Win\basetsd.h(53): error #2001: Syntax error: expected ';' but found 'INT64'.
D:\Program Files\PellesC\Include\Win\basetsd.h(53): warning #2099: Missing type specifier; assuming 'int'.
D:\Program Files\PellesC\Include\Win\basetsd.h(57): error #2120: Redeclaration of '__int64', previously declared at D:\Program Files\PellesC\Include\Win\basetsd.h(53); expected 'int' but found 'unsigned int'.
D:\Program Files\PellesC\Include\Win\basetsd.h(57): error #2001: Syntax error: expected ';' but found 'UINT64'.
D:\Program Files\PellesC\Include\Win\basetsd.h(57): warning #2099: Missing type specifier; assuming 'int'.
D:\Program Files\PellesC\Include\Win\winnt.h(558): fatal error #1014: #error: "No target architecture".