I'm swapping this from C to C++.
I am using codeblocks, this is giving me three errors/warnings.
using that one, I picked it because it stopped the nullptr errors, I am trying to get getopts to work in c++ - I did find something on the net that the example works so far. so I think I can wotk that one out.
AND this thing in here
Please surround your source code with code tags.
when I did already!
Code:
-std=c++0x
error: jump to case lable {-fpermissive}
char timerX[10] = "600x400"; // default image size
I am getting
note:
Code:
crosses initialization of 'char timerX[10]'
don't know what that means.
the switch itself:
starting at case 3: and the rest of them going down the switch
then it tells me I am missing the default case, which I am looking at it. it is there.
Code:
void set_switch_random_setting(void)
{
/* 1 two colors random angle
1 random colors w/o 0 image
2 random color w/ 1 image
3 random colors w/ 1 image
4 random color w/ random images
5 random colors w/ random images
6 random tile
7 random tile resized
8 random resized image w/ one one color
9 random resize image w / two colors
10 random resize image w/ random color
11 random resize image w/ random colors
*/
printf("in set_switch random settings\n");
//printf("in timer set_switch_random_setting ch_t %d\n", opts.ch_t);
//need to add for 2 random colors
//opts.set_random_angle
int get_ran_setting;
get_ran_setting = (rand() % 8);
//get_ran_setting = 7; // test purposesesss
switch (get_ran_setting)
{
case 0:
set_randy();
set_drawable();
display_image();
break;
case 1:
opts.set_random_color = (rand() % 10);
int i;
for ( i = 0; i < opts.set_random_color; i++)
set_rans();
get_random_angle();
set_random_fill_two_color_angle();
set_drawable();
display_image();
break;
case 2: // set same one color some kind of image;
//setting up bypass
opts.cycle_system_color = 1;
opts.set_randomize = 0;
// get_one_timed_image_at_a_time();
// set random colors
set_rans();
get_random_angle();
set_random_fill_two_color_angle();
//set center image mode
opts.mode = 11;
//keeps a default size
char timerX[10] = "600x400"; // default image size
if (opts.set_geometry == 1)
{
strcpy(opts.timer_1_FindX, opts.oppsXChar);
if (findX(timerX, &opts.get_img_w, &opts.get_img_h) == 0)
{
opts.set_newimg_w = opts.get_img_w;
opts.set_newimg_h = opts.get_img_h;
}
else
{
printf("bad form -g < %s >\n",opts.oppsXChar);
exit(1);
}
}
else
{
//set default image size
if (findX(timerX, &opts.get_img_w, &opts.get_img_h) == 0)
{
opts.set_newimg_w = opts.get_img_w;
opts.set_newimg_h = opts.get_img_h;
}
else
{
printf("bad form -g < %s >\n",timerX);
exit(1);
}
}
get_image();
break;
case 3:
if (opts.set_geometry == 1)
{
opts.mode = 15;
strcpy(opts.timer_1_FindX, opts.oppsXChar);
if (findX(opts.timer_1_FindX, &opts.get_img_w, &opts.get_img_h) == 0)
{
opts.set_newimg_w = opts.get_img_w;
opts.set_newimg_h = opts.get_img_h;
}
else
{
printf("bad form -g < %s >\n",opts.oppsXChar);
exit(1);
}
opts.set_cycle_system = 1;
opts.set_randomize = 0;
// get_one_timed_image_at_a_time();
get_image();
}
else
{
opts.set_cycle_system = 1;
opts.set_randomize = 1;
set_rans();
get_random_angle();
set_random_fill_two_color_angle();
opts.mode = 7;
get_image();
}
break;
case 4:
opts.mode = 3;
opts.set_cycle_system = 1;
opts.set_randomize = 0;
set_randy();
// get_one_timed_image_at_a_time();
get_image();
break;
case 5:
opts.mode = 1;
opts.set_cycle_system = 1;
opts.set_randomize = 0;
opts.set_random_color = (rand() % 30);
set_random_colors();
// get_one_timed_image_at_a_time();
get_image();
break;
case 6:
opts.mode = 3;
opts.set_cycle_system = 1;
opts.set_randomize = 0;
opts.set_random_color = (rand() % 30);
set_random_colors();
// get_one_timed_image_at_a_time();
get_image();
break;
case 7:
opts.mode = 19;
opts.set_cycle_system = 1;
opts.set_randomize = 1;
opts.set_random_color = (rand() % 30);
set_random_colors();
// get_one_timed_image_at_a_time();
get_image();
break;
case 8:
break;
default:
break;
} //end switch
}