Z
zolli
Hi,
I've been banging my head against this for a while now. Hoping someone
here can shed some light on what's going on.
On including stdlib.h in a file, I'm seeing the following errors:
----BEGIN ERRORS----
gcc -g3 -DUSE_LIBC -Wall -c -I../mm -I../include -I/usr/include
-I/usr/include/linux -o mm_tree_test.o mm_tree_test.c
In file included from mm_tree_test.c:2:
/usr/include/stdlib.h:137: error: syntax error before
"__ctype_get_mb_cur_max"
In file included from /usr/include/sys/types.h:266,
from /usr/include/stdlib.h:416,
from mm_tree_test.c:2:
/usr/include/bits/pthreadtypes.h:50: error: syntax error before "size_t"
/usr/include/bits/pthreadtypes.h:53: error: syntax error before
"__stacksize"
In file included from mm_tree_test.c:2:
/usr/include/stdlib.h:433: error: syntax error before "size_t"
/usr/include/stdlib.h:462: error: syntax error before "size_t"
/usr/include/stdlib.h:556: error: syntax error before "__size"
/usr/include/stdlib.h:558: error: syntax error before "__nmemb"
/usr/include/stdlib.h:567: error: syntax error before "size_t"
In file included from /usr/include/stdlib.h:578,
from mm_tree_test.c:2:
/usr/include/alloca.h:33: error: syntax error before "__size"
In file included from mm_tree_test.c:2:
/usr/include/stdlib.h:583: error: syntax error before "__size"
/usr/include/stdlib.h:739: error: syntax error before "size_t"
/usr/include/stdlib.h:743: error: syntax error before "size_t"
/usr/include/stdlib.h:812: error: syntax error before "size_t"
/usr/include/stdlib.h:815: error: syntax error before "size_t"
/usr/include/stdlib.h:819: error: syntax error before "size_t"
/usr/include/stdlib.h:822: error: syntax error before "size_t"
/usr/include/stdlib.h:830: error: syntax error before "size_t"
/usr/include/stdlib.h:833: error: syntax error before '*' token
/usr/include/stdlib.h:837: error: syntax error before "wchar_t"
/usr/include/stdlib.h:841: error: syntax error before "mbstowcs"
/usr/include/stdlib.h:841: error: syntax error before '*' token
/usr/include/stdlib.h:844: error: syntax error before "wcstombs"
/usr/include/stdlib.h:845: error: syntax error before '*' token
mm_tree_test.c: In function `main':
----END ERRORS----
I've posted all relevant code below. If I remove the line:
#include <stdlib.h>
from mm_tree_test.c, the errors go away. Any ideas?
Thanks in advance.
zolli
----BEGIN mm_tree_test.c----
#include <mm_tree.h>
#include <stdlib.h>
#include <macro.h>
int main( int argc, char** argv ) {
/* do nothing */
return 0;
}
----END mm_tree_test.c----
----BEGIN mm_tree.h----
#ifndef INCLUDE_MM_TREE_H
#define INCLUDE_MM_TREE_H
#include <stdtype.h>
struct mm_avlnode_str
{
uint32 val;
struct mm_avlnode_str *left;
struct mm_avlnode_str *right;
int32 height;
};
....(truncated)...
#endif /* INCLUDE_MM_TREE_H */
----END mm_tree.h----
----BEGIN mm_tree.c----
#include "mm_tree.h"
#include <macro.h>
/* pre-declarations */
static mmTreeNode insert( mmTreeNode node, mmTreeNode root );
static mmTreeNode remove( mmTreeNode node, mmTreeNode root );
....(truncated)...
/* API function implementations defined in .h */
void mmTree_insert( mmTree t, mmTreeNode node ) {
t->root = insert( node, t->root );
}
void mmTree_remove( mmTree t, mmTreeNode node ) {
t->root = remove( node, t->root );
}
....(truncated)...
----END mm_tree.c----
----BEGIN stdtype.h----
#ifndef INCLUDE_STDTYPE_H
#define INCLUDE_STDTYPE_H
typedef enum { FALSE, TRUE } bool;
#define ARCH_32_BIT 1
#define PAGE_LEN 0x1000 /* 4K */
#ifdef ARCH_32_BIT
#define int32 int
#define uint32 unsigned int
#define int16 short int
#define uint16 unsigned short int
#define int8 char
#define uint8 unsigned char
#define byte unsigned char
#endif
#define ulong unsigned long int
#define uint unsigned int
#define ushort unsigned short int
#define uchar unsigned char
#ifndef NULL
#define NULL ((void *)0)
#endif
#endif /* INCLUDE_STDTYPE_H */
----END stdtype.h----
----BEGIN macro.h----
#ifndef INCLUDE_MACRO_H
#define INCLUDE_MACRO_H
extern int printf(const char *format, ...);
#define log_err(format, args...) \
printf("[ERROR]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_warn(format, args...) \
printf("[WARN]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_trace(format, args...) \
printf("[TRACE]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_trace_fxn() \
printf("[TRACE-FXN]%s:%d:%s(): \n", \
__FILE__,__LINE__,__FUNCTION__)
#define log_dbg(format, args...) \
printf("[DEBUG]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_ver(format, args...) \
printf("[VERBOSE]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#endif /* INCLUDE_MACRO_H */
----END macro.h----
I've been banging my head against this for a while now. Hoping someone
here can shed some light on what's going on.
On including stdlib.h in a file, I'm seeing the following errors:
----BEGIN ERRORS----
gcc -g3 -DUSE_LIBC -Wall -c -I../mm -I../include -I/usr/include
-I/usr/include/linux -o mm_tree_test.o mm_tree_test.c
In file included from mm_tree_test.c:2:
/usr/include/stdlib.h:137: error: syntax error before
"__ctype_get_mb_cur_max"
In file included from /usr/include/sys/types.h:266,
from /usr/include/stdlib.h:416,
from mm_tree_test.c:2:
/usr/include/bits/pthreadtypes.h:50: error: syntax error before "size_t"
/usr/include/bits/pthreadtypes.h:53: error: syntax error before
"__stacksize"
In file included from mm_tree_test.c:2:
/usr/include/stdlib.h:433: error: syntax error before "size_t"
/usr/include/stdlib.h:462: error: syntax error before "size_t"
/usr/include/stdlib.h:556: error: syntax error before "__size"
/usr/include/stdlib.h:558: error: syntax error before "__nmemb"
/usr/include/stdlib.h:567: error: syntax error before "size_t"
In file included from /usr/include/stdlib.h:578,
from mm_tree_test.c:2:
/usr/include/alloca.h:33: error: syntax error before "__size"
In file included from mm_tree_test.c:2:
/usr/include/stdlib.h:583: error: syntax error before "__size"
/usr/include/stdlib.h:739: error: syntax error before "size_t"
/usr/include/stdlib.h:743: error: syntax error before "size_t"
/usr/include/stdlib.h:812: error: syntax error before "size_t"
/usr/include/stdlib.h:815: error: syntax error before "size_t"
/usr/include/stdlib.h:819: error: syntax error before "size_t"
/usr/include/stdlib.h:822: error: syntax error before "size_t"
/usr/include/stdlib.h:830: error: syntax error before "size_t"
/usr/include/stdlib.h:833: error: syntax error before '*' token
/usr/include/stdlib.h:837: error: syntax error before "wchar_t"
/usr/include/stdlib.h:841: error: syntax error before "mbstowcs"
/usr/include/stdlib.h:841: error: syntax error before '*' token
/usr/include/stdlib.h:844: error: syntax error before "wcstombs"
/usr/include/stdlib.h:845: error: syntax error before '*' token
mm_tree_test.c: In function `main':
----END ERRORS----
I've posted all relevant code below. If I remove the line:
#include <stdlib.h>
from mm_tree_test.c, the errors go away. Any ideas?
Thanks in advance.
zolli
----BEGIN mm_tree_test.c----
#include <mm_tree.h>
#include <stdlib.h>
#include <macro.h>
int main( int argc, char** argv ) {
/* do nothing */
return 0;
}
----END mm_tree_test.c----
----BEGIN mm_tree.h----
#ifndef INCLUDE_MM_TREE_H
#define INCLUDE_MM_TREE_H
#include <stdtype.h>
struct mm_avlnode_str
{
uint32 val;
struct mm_avlnode_str *left;
struct mm_avlnode_str *right;
int32 height;
};
....(truncated)...
#endif /* INCLUDE_MM_TREE_H */
----END mm_tree.h----
----BEGIN mm_tree.c----
#include "mm_tree.h"
#include <macro.h>
/* pre-declarations */
static mmTreeNode insert( mmTreeNode node, mmTreeNode root );
static mmTreeNode remove( mmTreeNode node, mmTreeNode root );
....(truncated)...
/* API function implementations defined in .h */
void mmTree_insert( mmTree t, mmTreeNode node ) {
t->root = insert( node, t->root );
}
void mmTree_remove( mmTree t, mmTreeNode node ) {
t->root = remove( node, t->root );
}
....(truncated)...
----END mm_tree.c----
----BEGIN stdtype.h----
#ifndef INCLUDE_STDTYPE_H
#define INCLUDE_STDTYPE_H
typedef enum { FALSE, TRUE } bool;
#define ARCH_32_BIT 1
#define PAGE_LEN 0x1000 /* 4K */
#ifdef ARCH_32_BIT
#define int32 int
#define uint32 unsigned int
#define int16 short int
#define uint16 unsigned short int
#define int8 char
#define uint8 unsigned char
#define byte unsigned char
#endif
#define ulong unsigned long int
#define uint unsigned int
#define ushort unsigned short int
#define uchar unsigned char
#ifndef NULL
#define NULL ((void *)0)
#endif
#endif /* INCLUDE_STDTYPE_H */
----END stdtype.h----
----BEGIN macro.h----
#ifndef INCLUDE_MACRO_H
#define INCLUDE_MACRO_H
extern int printf(const char *format, ...);
#define log_err(format, args...) \
printf("[ERROR]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_warn(format, args...) \
printf("[WARN]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_trace(format, args...) \
printf("[TRACE]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_trace_fxn() \
printf("[TRACE-FXN]%s:%d:%s(): \n", \
__FILE__,__LINE__,__FUNCTION__)
#define log_dbg(format, args...) \
printf("[DEBUG]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#define log_ver(format, args...) \
printf("[VERBOSE]%s:%d:%s(): " format "\n", \
__FILE__,__LINE__,__FUNCTION__, ##args)
#endif /* INCLUDE_MACRO_H */
----END macro.h----