• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C macro compilation error on struct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C macro compilation error on struct


  • Subject: Re: C macro compilation error on struct
  • From: Anthony Smith <email@hidden>
  • Date: Mon, 27 Jul 2009 21:29:03 -0400

Sorry, figured it out.

Here's what I see when I do gcc -E. I don't see anything referencing curses.h. When I build using a makefile it compiles and works just fine. I only see this issue when building in Xcode. Any possibility Xcode may be messing up?

typedef struct _sdl_window_info sdl_window_info;
struct _sdl_window_info
{

 sdl_window_info * next;


 running_machine * machine;


 int (*create)(sdl_window_info *window, int width, int height);
 void (*resize)(sdl_window_info *window, int width, int height);
 int (*draw)(sdl_window_info *window, UINT32 dc, int update);
 const render_primitive_list *(*get_primitives)(sdl_window_info *window);
 int (*xy_to_render_target)(sdl_window_info *window, int x, int y, int *xt, int *yt);
 void (*destroy_all_textures)(sdl_window_info *window);
 void (*destroy)(sdl_window_info *window);
 void (*clear)(sdl_window_info *window);


 char title[256];


 sdl_monitor_info * monitor;
 int fullscreen;
 int index;


 int minwidth, minheight;
 int maxwidth, maxheight;
 int depth;
 int refresh;
 int windowed_width;
 int windowed_height;
 int startmaximized;


 osd_event * rendered_event;
 render_target * target;
 const render_primitive_list *primlist;


 void * dxdata;


 int width;
 int height;


 int blitwidth;
 int blitheight;

 int totalColors;
 int start_viewscreen;


 int scale_mode;


 int prescale;
 int prescale_effect;





};

On Jul 27, 2009, at 9:15 PM, Anthony Smith wrote:

The reason I say curses is because when I jump to definition in Xcode that's the only macro I see. I'm confused as to why it would be looking there.

I preprocess and get the error. Where is the file I need to view located?

On Jul 27, 2009, at 9:08 PM, Greg Parker wrote:

On Jul 27, 2009, at 6:00 PM, Anthony Smith wrote:
I'm currently trying to compile a C file which is throwing a "macro 'clear' passed 1 arguments, but takes just 0" when "clear" is part of a struct, not a macro. It looks like GCC is trying to use a macro defined in curses.h rather than the file's header. "curses.h" isn't referenced anywhere within my project. Here's the relevant code:

Header portion
typedef struct _sdl_window_info sdl_window_info;
struct _sdl_window_info
{
[...]
void (*clear)(sdl_window_info *window);
[...]
};

C source portion
static OSDWORK_CALLBACK( sdlwindow_clear_surface_wt )
{
worker_param *wp = (worker_param *) param;
sdl_window_info *window = wp->window;

ASSERT_WINDOW_THREAD();

window->clear(window);
free(wp);
return NULL;
}

There's definitely code somewhere with `#define clear() ...`. curses.h is a good guess, but not certain. The next debugging step is to look at the preprocessed version of your code, which should show the #define, the file it comes from, and the #include sequence that pulled it in. In Xcode, use Build>Preprocess. From the command line, use `gcc -E`. Then search that file for the definition you don't like.


-- 
Greg Parker     email@hidden     Runtime Wrangler




Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: trouble with distributed builds
  • Next by Date: Re: trouble with distributed builds
  • Previous by thread: Re: Snapshot failed
  • Next by thread: Link Issue
  • Index(es):
    • Date
    • Thread