<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/26162/display-h-72-warning-231-d-declaration-is-not-visible-outside-of-function</link><description> 
..\display.h(72): warning: #231-D: declaration is not visible
outside of function 

 
I got message when I included a header file containing this
line: 

 
void DISPLAY_string_date_time(const struct tm * tim, DISPLAY_MSG *
p_message); 

 
I found the</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/144719?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2009 23:29:22 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:45ca4d70-ad5a-4d2e-9e2b-fec7397565ee</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yes, indeed - this has been noted before!&lt;/p&gt;

&lt;p&gt;
eg, my post of 4-Sep-2009 17:22 GMT in this thread: &lt;a href="http://www.keil.com/forum/docs/thread15484.asp"&gt;http://www.keil.com/forum/docs/thread15484.asp&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/142432?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2009 16:23:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d4a1fdd6-98c3-4ccc-a4cc-33af4e50f741</guid><dc:creator>Bruce Partridge</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks Dan.&lt;/p&gt;

&lt;p&gt;
That makes perfect sense now. Life would be simpler if there were
a place where the error message was explained with the two paragraphs
you just wrote.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/139317?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2009 13:07:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:99b7b1a6-7c59-4b16-9b78-6a6239b06247</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;That&amp;#39;s probably because nothing has directly caused it; it is
probably caused &amp;quot;indiectly&amp;quot; as a result of the compiler getting
out-of-sync with the source text because of the original error(s) due
to the missing header(s).&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
No. There are situations where this happens, and causes all kinds
of weird messages from the compiler. But this is not one of them.&lt;/p&gt;

&lt;p&gt;
The warning message under discussion is fully justified, and its
text points exactly at the problem.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/56818?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2009 13:04:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:314cbc70-0ef7-4ff2-9ef3-e3f24576cbde</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;After a lot of searching for what this warning means, I can&amp;#39;t
find any explanation.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You&amp;#39;ve already found all essential elements of the explanation.
You just haven&amp;#39;t connected the dots yet.&lt;/p&gt;

&lt;p&gt;
The problem is in that header you included: it can&amp;#39;t stand on its
own feet. This header uses struct tm, which is a type defined in
&amp;lt;time.h&amp;gt;. So it really should #include &amp;lt;time.h&amp;gt; to have
it available.&lt;/p&gt;

&lt;p&gt;
Since it didn&amp;#39;t, the &amp;quot;struct tm *&amp;quot; in that function&amp;#39;s argument
list is a forward declaration of type struct tm, but one that only
applies to the function prototype it&amp;#39;s in. That&amp;#39;s surely not what it
was supposed to mean. I.e. the code doesn&amp;#39;t do what its author is
most likely to have intended. The compiler is absolutely correct
warning you about it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/142423?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 13:46:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:14049773-c98d-478e-a269-6ebe46892dc0</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You are right.&lt;/p&gt;

&lt;p&gt;
The compiler makes a difference between:&lt;/p&gt;

&lt;pre&gt;
int function(struct tm* t);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
and&lt;/p&gt;

&lt;pre&gt;
struct tm;
int function(struct tm* t);
&lt;/pre&gt;

&lt;p&gt;
I haven&amp;#39;t thought about this case before. I always have the second
alternative, if I need to make use of a struct or class pointer
without letting the header file see the full definition.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/139315?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 13:36:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3348d8a5-819b-4b14-bb08-bad619585ebf</guid><dc:creator>ashley madison</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;I don&amp;#39;t understand why I wouldn&amp;#39;t just get an &amp;quot;Identifier
undefined&amp;quot; type of error.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
The function prototype declaration does not require knowledge
about the size of &amp;quot;struct tm&amp;quot;, so is allowed without the complete
structure type definition being in scope. An &lt;b&gt;error&lt;/b&gt; diagnostic
would be unwarranted in this case (but compilers are allowed to
&lt;b&gt;warn&lt;/b&gt; about anything).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/130530?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 13:13:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ee94a1ba-23ac-4288-9506-a4a95e4881f4</guid><dc:creator>Bruce Partridge</dc:creator><description>&lt;p&gt;&lt;p&gt;
To clarify, there are no errors. I get one warning. The compiler
has definitely not lost the syntax trail.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/130529?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 10:05:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5dab9c92-fa4c-4ba6-a2a0-1633455f6faa</guid><dc:creator>Bruce Partridge</dc:creator><description>&lt;p&gt;&lt;p&gt;
Here is the code. I have included the relevant bits of what&amp;#39;s in
the include file.&lt;/p&gt;

&lt;p&gt;
To clarify one more time, there are no errors. It is only a
warning. It compiles and runs. But I can&amp;#39;t check in code with
warnings, so I had to find it.&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;time.h&amp;gt;
...more
struct tm {
    int tm_sec;   /* seconds after the minute, 0 to 60
                     (0 - 60 allows for the occasional leap second) */
    int tm_min;   /* minutes after the hour, 0 to 59 */
    int tm_hour;  /* hours since midnight, 0 to 23 */
    int tm_mday;  /* day of the month, 1 to 31 */
    int tm_mon;   /* months since January, 0 to 11 */
    int tm_year;  /* years since 1900 */
    int tm_wday;  /* days since Sunday, 0 to 6 */
    int tm_yday;  /* days since January 1, 0 to 365 */
    int tm_isdst; /* Daylight Savings Time flag */
    union {       /* ABI-required extra fields, in a variety of types */
        struct {
            int __extra_1, __extra_2;
        };
        struct {
            long __extra_1_long, __extra_2_long;
        };
        struct {
            char *__extra_1_cptr, *__extra_2_cptr;
        };
        struct {
            void *__extra_1_vptr, *__extra_2_vptr;
        };
    };
};
...more

#include &amp;quot;display.h&amp;quot;
...more
typedef struct
{
    uint32_t    x;
    uint32_t    y;
    uint32_t    size;
    uint32_t    font;
    uint8_t     text[24];
} DISPLAY_MSG;
void DISPLAY_string_date_time(const struct tm * tim, DISPLAY_MSG * p_message);
...more
&lt;/pre&gt;

&lt;p&gt;
If I comment out &amp;lt;time.h&amp;gt;, I get the warning and a clean
compile. With &amp;lt;time.h&amp;gt; in I don&amp;#39;t get the warning.&lt;/p&gt;

&lt;p&gt;
I don&amp;#39;t understand why I wouldn&amp;#39;t just get an &amp;quot;Identifier
undefined&amp;quot; type of error.&lt;/p&gt;

&lt;p&gt;
The reason I&amp;#39;m willing to try to find an answer is that I spent a
lot of time searching for an explanation. If I understood why I got
that error this time, I might find it faster next time. It would have
taken 10 seconds to find if I had got an &amp;quot;Identifier undefined&amp;quot;
error.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/135913?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 09:44:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:85dd769c-ab59-41d3-b95e-61df838731b6</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
That&amp;#39;s probably because nothing has &lt;i&gt;directly&lt;/i&gt; caused it; it
is probably caused &amp;quot;indiectly&amp;quot; as a result of the compiler getting
out-of-sync with the source text because of the original error(s) due
to the missing header(s).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/125707?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 09:40:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2325b77a-729a-4c9a-8f50-e6060d221cbc</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Not without seeing your actual source code, of course.&lt;/p&gt;

&lt;p&gt;
But I very much suspect that it is as I suggested: your initial
error(s) due to the missing header have thrown the compiler so far
out-of-sync with your source text that it is giving apparently
meaningless messages.&lt;/p&gt;

&lt;p&gt;
Sometimes it can get so grossly out-of-sync that it will actually
crash!&lt;/p&gt;

&lt;p&gt;
If you really want to pursue it, you need to look at the point of
the very first error and ask yourself what the compiler is
&lt;i&gt;assuming&lt;/i&gt; was there - having rejected what you actually wrote
as invalid, and so on...&lt;/p&gt;

&lt;p&gt;
But, as I said, it is pointless - just fix the original error, and
that will naturally fix all the consequent errors!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/125710?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 09:23:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:66796c3d-35ac-466c-8d94-1f2491b5342e</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
I would really be interested too. I can&amp;#39;t directly see what source
code error that would motivate the error message.&lt;/p&gt;

&lt;p&gt;
Something declared within a function is intended to be only
visible within the function, so there should not be any warning.&lt;/p&gt;

&lt;p&gt;
Do you have any data types declared in any of your functions? In
case the compiler saw tm being declared somewhere else in the code,
it might have decided to be overly clever and warn that your
undefined global tm use could not be matched with the local
definition int saw somewhere else. But in that case, the compiler
should have been so clever that it showed the other line number
too.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/115223?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 08:57:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9e4469a7-762a-4be7-bc96-50c826533ba7</guid><dc:creator>Bruce Partridge</dc:creator><description>&lt;p&gt;&lt;p&gt;
I get that you can&amp;#39;t explain it.&lt;/p&gt;

&lt;p&gt;
I&amp;#39;m still interested though.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/103407?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 08:39:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:238bfd2a-a77f-4a73-8415-f05deafe4c71</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
In order to understand that, it would be necessary to see exactly
what you gave to the compiler to cause it.&lt;/p&gt;

&lt;p&gt;
As you haven&amp;#39;t shown that, it is impossible to tell!&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;I know what the error was caused by. It was missing the
definition of the tm struct in &amp;lt;time.h&amp;gt;.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
When you&amp;#39;ve had one error like that, it almost certainly means
that the compiler is &amp;quot;out-of-sync&amp;quot; with your source text from that
point on - it is therefore pointless worrying about subsequent
errors, as they are almost certainly affected by the initial
error.&lt;/p&gt;

&lt;p&gt;
If you&amp;#39;ve fixed the &amp;quot;tm struct&amp;quot; error, and then all the other
messages just &amp;quot;magically&amp;quot; disappear, that confirms that they were all
just consequences of that one error.&lt;/p&gt;

&lt;p&gt;
Move along now - nothing (more) to see here...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/77754?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 08:15:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:20fc8eb2-5402-4e22-ac5f-119bb1f7c03b</guid><dc:creator>Bruce Partridge</dc:creator><description>&lt;p&gt;&lt;p&gt;
I wouldn&amp;#39;t ask for a translation if I didn&amp;#39;t need one.&lt;/p&gt;

&lt;p&gt;
I know what the error was caused by. It was missing the definition
of the tm struct in &amp;lt;time.h&amp;gt;.&lt;/p&gt;

&lt;p&gt;
What I don&amp;#39;t understand is why I wouldn&amp;#39;t just get an undefined
reference error.&lt;/p&gt;

&lt;p&gt;
I would like to understand how the compiler interpreted this to
end up with this error.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ..\display.h(72): warning:  #231-D: declaration is not visible outside of function</title><link>https://community.arm.com/thread/56813?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2009 08:11:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:647eb49b-5399-4b32-8185-ccd8cbee661d</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Surely, it doesn&amp;#39;t need any translation?&lt;/p&gt;

&lt;p&gt;
But it is impossible to guess which declaration, and which
function it is referring to without seeing the relevant source
line(s)!&lt;/p&gt;

&lt;p&gt;
Are you sure that you included the header at an appropriate
position...?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>