C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-12-2007, 05:30 AM   #1
System Novice
 
siavoshkc's Avatar
 
Join Date: Jan 2006
Location: Tehran
Posts: 1,074
Compiling 3rd party code problem me too

Code:
typedef struct DIALOG
{
   DIALOG_PROC proc;
   int x, y, w, h;               /* position and size of the object */
   int fg, bg;                   /* foreground and background colors */
   int key;                      /* keyboard shortcut (ASCII code) */
   int flags;                    /* flags about the object state */
   int d1, d2;                   /* any data the object might require */
   void *dp, *dp2, *dp3;         /* pointers to more object data */
} DIALOG;

typedef struct
{
   int option_value;
} OPTION_ELEMENT;

static DIALOG options_dialog[] =
{
   /* (proc)              (x)  (y)  (w)  (h)  (fg)      (bg)           (key) (flags) (d1) (d2) (dp)                       (dp2) (dp3)                               */
   { d_shadow_box_proc,   0,   0,   231, 440, 0,         C_LIGHT_GRAY,  0,    0,      0,   0,   NULL,                      NULL, NULL                                },
   { d_shadow_box_proc,   0,   0,   231, 24,  0,         C_DARK_GRAY,   0,    0,      0,   0,   NULL,                      NULL, NULL                                },
   { caption_proc,        115, 2,   113, 19,  C_WHITE,   C_TRANSP,      0,    0,      0,   0,   "Program Options",         NULL, NULL                                },
   { d_text_proc,         16,  32,  200, 16,  C_BLACK,   C_TRANSP,      0,    0,      0,   0,   "System Of Measurements:", NULL, NULL                                },
   { option_element_proc, 48,  56,  80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      0,   0,   "Metric",                  NULL, &(OPTION_ELEMENT){METRIC}           },
   { option_element_proc, 48,  72,  88,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      0,   0,   "US",                      NULL, &(OPTION_ELEMENT){IMPERIAL}         },
   { d_text_proc,         16,  96,  152, 16,  C_BLACK,   C_TRANSP,      0,    0,      0,   0,   "COM Port:",               NULL, NULL                                },
   { option_element_proc, 48,  120, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM1",                    NULL, &(OPTION_ELEMENT){COM1}             },
   { option_element_proc, 48,  136, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM2",                    NULL, &(OPTION_ELEMENT){COM2}             },
   { option_element_proc, 48,  152, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM3",                    NULL, &(OPTION_ELEMENT){COM3}             },
   { option_element_proc, 48,  168, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM4",                    NULL, &(OPTION_ELEMENT){COM4}             },
   { option_element_proc, 48,  184, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM5",                    NULL, &(OPTION_ELEMENT){COM5}             },
   { option_element_proc, 48,  200, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM6",                    NULL, &(OPTION_ELEMENT){COM6}             },
   { option_element_proc, 48,  216, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM7",                    NULL, &(OPTION_ELEMENT){COM7}             },
   { option_element_proc, 48,  232, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      1,   0,   "COM8",                    NULL, &(OPTION_ELEMENT){COM8}             },
   { d_text_proc,         16,  256, 200, 16,  C_BLACK,   C_TRANSP,      0,    0,      0,   0,   "Baud Rate:",              NULL, NULL                                },
   { option_element_proc, 48,  280, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      2,   0,   "9600",                    NULL, &(OPTION_ELEMENT){BAUD_RATE_9600}   },
   { option_element_proc, 48,  296, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      2,   0,   "38400",                   NULL, &(OPTION_ELEMENT){BAUD_RATE_38400}  },
   { d_text_proc,         16,  320, 200, 16,  C_BLACK,   C_TRANSP,      0,    0,      0,   0,   "Display Mode:",           NULL, NULL                                },
   { option_element_proc, 48,  344, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      3,   0,   "Windowed",                NULL, &(OPTION_ELEMENT){WINDOWED_MODE}    },
   { option_element_proc, 48,  360, 80,  10,  C_BLACK,   C_LIGHT_GRAY,  0,    0,      3,   0,   "Full Screen",             NULL, &(OPTION_ELEMENT){FULL_SCREEN_MODE} },
   { save_options_proc,   16,  384, 92,  40,  C_BLACK,   C_GREEN,       's',  D_EXIT, 0,   0,   "&Save",                   NULL, NULL                                },
   { d_button_proc,       123, 384, 92,  40,  C_BLACK,   C_DARK_YELLOW, 'c',  D_EXIT, 0,   0,   "&Cancel",                 NULL, NULL                                },
   { NULL,                0,   0,   0,   0,   0,       0,               0,    0,      0,   0,   NULL,                      NULL, NULL                                }
};
Code does not compile on my MSVC2005. I think it is because of C old style formal list like:
Code:
&(OPTION_ELEMENT){METRIC}  //and
&(OPTION_ELEMENT){COM6}
What should I do? Its C code but I tried both c and cpp extensions for file. In C mode it says syntax error { and }. In cpp mode it says that too, but also warns about old-style C formal listing
__________________
Microsoft Visual Studio 2008 Professional (On Microsoft Windows XP SP2)

Learn the language before using it. (C++ Books and C Books)
Read the FAQ before making a problem.
Then make a Google and Forum search.

My code painter new version Version 0.97 DOWNLOAD NOW! (Let the pop up, pop!)

SiavoshKC
siavoshkc is offline   Reply With Quote
Old 09-12-2007, 05:55 AM   #2
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,844
Create static instances of each one of those option elements, then take the address of those static instances.

gg
Codeplug is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with compiling code in cygwin firyace C++ Programming 4 06-01-2007 08:16 AM
Binary Search Trees Part III Prelude A Brief History of Cprogramming.com 16 10-02-2004 03:00 PM
problem with selection code DavidP Game Programming 1 06-14-2004 01:05 PM
Problem : Threads WILL NOT DIE!! hanhao C++ Programming 2 04-16-2004 01:37 PM
Big Code, Little Problem CodeMonkey Windows Programming 4 10-03-2001 05:14 PM


All times are GMT -6. The time now is 05:28 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22