我该如何创建头文件? [英] how can I create a header file ?

查看:86
本文介绍了我该如何创建头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在其他地方找到了对此的想法,但即使我使用了我的编译器(Dev C ++)的预制头文件,我认为它应该被称为Devil C ++,并将所有代码替换为一个并将其更改为在C(据我所知)我继续得到一个错误或2(我已经见过其他人谈论这个错误)。你能不能指导我制作我自己的标题(如果我学会了如何做非标准的C标题,我可能会尝试制作一个我认为可以用作操作系统的迷你程序,是的,我之前尝试过汇编语言(我想我可以问我的叔叔,因为他们中的一个已经完成了机器人技术)。我得到的错误是


[链接错误]未定义引用`WinMain @ 16''

ld返回1退出状态

C:\ Users \roddy \Documents\RAD Studio \7.0 \ Demos \CPP \ Apps \ ImageProc \ Makefile .win [Build Error] [Project1.exe]错误1


我的代码是:

random.c

I''ve found thinks on this in other places, But even when I used premade headers from my compiler ( Dev C++) which should be called Devil C++ in my opinion, and replaced all the code from one and altered it to be in C ( as to my knowledge) I keep on getting an error or 2 ( I''ve seen others talk about this error though). can you guys walk me through making my own headers( if i learn how to do non standard based C headers I might try and make a mini program that I think could work as an OS, And yes I''ve tried assembly language before ( I think I can ask my uncle as one of them has done robotics). the errors I get are

[Linker error] undefined reference to `WinMain@16''
ld returned 1 exit status
C:\Users\roddy\Documents\RAD Studio\7.0\Demos\CPP\Apps\ImageProc\Makefile.win [Build Error] [Project1.exe] Error 1

my code is:
random.c

展开 | 选择 | Wrap | 行号

推荐答案

头文件没什么特别之处。它们只是文本文件。它们只被称为头文件,因为它们通常包含在实现文件的开头(或头部)。

.h扩展名不是必需的,但它在C. C ++标准中是通用的头文件没有扩展名。

你需要注意这个:

There is nothing special about header files. They are just text files. They are only called header files because usually they are included at the beginning (or head) of the implementation file.

The .h extension is not required but it customary in C. C++ standard header files have no extension.
You do need to be careful of this:

展开 | 选择 | 换行 | 行号


查看你的帖子。我看到缺少对WinMain16的引用。


这告诉我:a)你正在使用Visual Studio而b)你错误地设置了你的项目。


你所拥有的是一个生成Windows程序的Windows项目。可能你想要一个控制台应用程序,所以你可以使用main()。


如果是这样的话:


1)创建一个Win32项目。

2)当向导出现时不要点击完成。

3)而是单击应用程序设置

4)选择控制台应用程序和清空项目

5)现在点击Finish.


TheWinMain16错误将消失。
On looking at your post. I see a missing reference to WinMain16.

That tells me: a) you are using Visual Studio and b) you have incorrectly set up your project.

What you have is a Windows project to produce a Windows program. Probably you wanted a console application so you could use main().

If so do this:

1) Create a Win32 project.
2) When the wizard appears DO NOT CLICK FINISH.
3) Instead click Application Settings
4) Select Console Application and Empty Project
5) Now click Finish.

TheWinMain16 error will go away.


我显然遗漏了一些东西我'我试过的是:


使用编译器头文件作为模板,

复制代码说是准确的,


这两个给了我相同的结果然后我拿出了一些我认为仅仅是为了示例而且我得到了更多的错误把它放回去,正如我记得的那样,我想到了更多的错误。
I obviously am missing something things I''ve tried are:

using compilers headers as a template,
copying a code said to be accurate,

both of these gave me the same result then i took something out that I thought was just for the example and I got more errors put it back in exactly as I remembered it and got even more errors I think.


这篇关于我该如何创建头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆