Problem with where I declare a pointer in a file.

Mike Baranski mbaranski@celito.net
Sun Apr 8 09:14:00 GMT 2001


Hi folks, I don't know if this is a bug or not, but I'll run it by you
anyway.

I have a project that has quite a few files and stuff, and I'm using a
configure script to set everything up.  In one file (support.h) I have
the following:

#include <gnome.h>
/* Some other defs */

GList *
get_name_values_from_table(void);

/* Some more defs */

and in support.c I have:

#include <gnome.h>
#include <mysql.h>
#include "structs.h"

/* Some code that compiles fine */

GList *
get_name_values_from_table(void)
{

    int i;
    int num_fields;

/* Mark */
    char *insert_stmt;
    insert_stmt = g_malloc (sizeof(char) * MAX_STRING_LENGTH);
    GList *names;
/* The rest of the function */

The last line, GList *names, causes errors with the compiler.

If I move it to where /* Mark */ is, it compiles fine.  I did not post
the rest of the files b/c I've had no other trouble with this project
until I added this function.  I'm using

gcc version 2.96 20000731 (Red Hat Linux 7.0)

If you want me to, I can post the source in a tarball on my account at
school so you can get to it via HTTP, but I think that this is the
problem, I've tried to narrow it down.

The include files are for mysql and gtk+, and I generated the initial
skelleton with Glade, but I've done the rest by hand.

I hope that this is helpful, and if you need anything else, just lemme
know.

mbaranski@celito dot net, as I don't monitor this list.

If this isn't a bug, sorry...



More information about the Gcc-bugs mailing list