sbit definitions with SDCC - Error: "initializer element is not constant"
Your code is not valid C. It should look like this:

#include &lt;reg51.h&gt;
#define cmdport P3
#define dataport P2
#define q 100


To create sbit definitions for the individual bits in P3 (address 0xB0), you want:

__sbit __at (0xB0) rs; // P3.0
__sbit __at (0xB1) rw; // P3.1
__sbit __at (0xB6) e;  // P3.6


Though, if you look in sdcc/includes/mcs51/8051.h you'll find that there are already generic definitions for P3_0 and so on, allowing you to write:

#define rs P3_0
#define rw P3_1
#define e  P3_6


I'd also recommend that you pick more descriptive names for your bit definitions than rs, rw and e as these may clash with variable names.