---
title: "previous implicit declaration of 'some_function' was here"
author: "wangleide414"
date: "2012-10-29T11:03:49Z"
tags: []
categories: ["编程语言"]
slug: "previous-implicit-declaration-of-some-function-was-here"
draft: false
lastmod: "2012-10-29T11:03:49Z"
id: 1707160
url: "https://wangleide414.iteye.com/blog/1707160"
---

## error: previous implicit declaration of 'some\_function' was here的解决办法

error: previous implicit declaration of 'some\_function' was here

Solution: Didn't your programming teacher tell you to always make function prototypes? He/she had good reason. It's also best to have them at the top, global space of the file, not in weird places. Yes, I have seen a function declared within another function, just before it gets called. Try to avoid that!

 

原因：注意函数在声明的时候注意顺序。

在写源代码的时候

|\*\*\*\*\*\*\*\*\*\*\*|

|\** A\*\*\*\*\*\*|

|\** B\*\*\*\*\*\*|

|\*\*\*\*\*\*\*\*\*\*\*|

其中A函数要调用B函数，此时就会在A函数处出现 previous implicit declaration of B was here的现象。

如果将代码改为

|\*\*\*\*\*\*\*\*\*\*\*|

|\** B\*\*\*\*\*\*|

|\** A\*\*\*\*\*\*|

|\*\*\*\*\*\*\*\*\*\*\*|此时在A里调用B便不会出现错误了.