user20713: I'll post the whole code if you really need to see it, but my question is pretty simple.
In my sketch I define some parameters:
#define SSID "Kaywinnet"
#define PASSWORD "806194edb8"
#define MQTT_SERVER { 192, 168, 1, 124 }

And, the sketch compiles just fine.
But, rather than putting my net parameters into every sketch, I wanted to just use a .h file so that if something changes, I only have to change it once.
Here's the problem.  When I put these three lines into a .h file, I get an error when the first parameter is used in the sketch:
expected primary-expression before '.' token

Here is the code where I use the value:
//Initialize ESPHelper
netInfo homeNet = {
  .mqttHost = mqtt_server,
  .mqttUser = "",
  .mqttPass = "",
  .mqttPort = 1883,
  .ssid = SSID,
  .pass = password
};
ESPHelper myESP(&homeNet);

The error is on the .ssid= line.
So, why does it compile when I define the parameters in the sketch, and gives an error when I put them into a .h file??
Here's the ino file:
    /*****

  Projects/esp8266/MQTT nodes/light2.ino
  10/3/2017- Clone of studio.ino

  IDE settings:
  Board: "Generic 8266 Module"
  Flash Mode: "DOUT"

*****/


#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <ESPHelper.h>

//#include <Kaywinnet.h>
#define SSID "Kaywinnet"
#define password "806194edb8"
#define mqtt_server "192.168.1.124"

//#define toggle    //Using toggle switch.
#define pushbutton    //Using pushbutton switch


#define NODENAME "light2"
const char *cmdTopic =  NODENAME "/light";
const char *statusTopic = NODENAME "/light/status";
const char *connectName =  NODENAME "lights";
#define OTAPASSWORD "xxxx"



//Defaults to DHCP, if you want a static IP, configure below
//#define STATIC_IP
#ifdef STATIC_IP
IPAddress ip(192, 168, 1, 50);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
#endif



//Initialize ESPHelper
netInfo homeNet = {
  .mqttHost = mqtt_server,
  .mqttUser = "",
  .mqttPass = "",
  .mqttPort = 1883,
  .ssid = SSID,
  .pass = password
};
ESPHelper myESP(&homeNet);


//Declare an object of class WiFiClient
WiFiClient esplight2;
PubSubClient client(esplight2);


#define esp8266-01    //Either sonoff or esp8266-01

//Define the GPIO pins on the 8266-01
#ifdef esp8266-01
const int buttonPin = 0;    //GPIO0
const int relayPin = 2;     //GPIO2
#endif

#ifdef Sonoff
const int buttonPin = 0;     //GPIO0
const int extraPin = 14;
const int ledPin = 13;
const int relayPin = 12;
const bool ledOFF = HIGH;
const bool ledON = LOW;
#endif

int switchVal = 0;
int currentVal = 0;
bool relayState;
String payLoad;


// * *************** RelayControl, remember the state ***************
//
void RelayControl(bool state) {
  //Serial.print("relayState: ");
  //Serial.println(relayState);

  digitalWrite(relayPin, state ? HIGH : LOW);
  relayState = state;

  //Feedback over MQTT
  if (relayState) {
    client.publish(statusTopic, "on");    //Tell Node Red about the current status
    Serial.println(String(statusTopic) + "= on.");
  } else {
    client.publish(statusTopic, "off");
    Serial.println(String(statusTopic) + "= off.");
  }
  Serial.println();
}



void timeLoop (long int startMillis, long int interval) { // the delay function
  while (millis() - startMillis < interval) {}
}




/*
 * ************** blink the LED ************************
   We assume the LED is on after connecting.
*/
void blinkLED() {
#ifdef esp8266-01
  return;   //No led on the esp to blink..
#endif
#ifdef Sonoff
  digitalWrite(ledPin, ledOFF);
  delay(500);
  digitalWrite(ledPin, ledON);
#endif
}




/*
 * ******************** set up WiFi ****************
*/
void setup_wifi() {
  delay(10);
  // We start by connecting to a WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(SSID);

  //Connect to WiFi network so we can reach the MQTT broker and publish messages to topics.
  WiFi.mode(WIFI_STA);
  WiFi.begin(SSID, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("WiFi connected - ESP IP address: ");
  Serial.println(WiFi.localIP());
}



/*
 * *************** MQTT callback ********************
*/
void callback(String topic, byte* message, unsigned int length) {
  Serial.print("Message arrived on topic: ");
  Serial.print(topic);
  Serial.print(". Message: ");

  String messageTemp;
  for (int i = 0; i < length; i++) {
    //Serial.print((char)message[i]);
    messageTemp += (char)message[i];
  }
  messageTemp.trim();            // trim the white space off the string

  Serial.println(messageTemp);

  // If a message is received with the topic 'cmdTopic', check if the message is either on or off.
  if (topic == cmdTopic) {
    if (messageTemp == "on") {
      Serial.println("Light2 is ON");
      RelayControl(HIGH);
      blinkLED();

    }
    else if (messageTemp == "off") {
      Serial.println("Light2 is OFF");
      RelayControl(LOW);
      blinkLED();

    }
  }
}





/*
 * **************** Connect to MQTT broker **************
   This functions reconnects your ESP8266 to the MQTT broker and subscribes to topics.
*/
void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");

    // Attempt to connect
    if (client.connect(connectName)) {
      Serial.println("connected");
#ifdef Sonoff
      digitalWrite(ledPin, ledON);
#endif
      // Subscribe or resubscribe to a topic
      client.subscribe(cmdTopic);
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      delay(5000);
    }
  }
}





/*
 * *************** SETUP ********************
*/
void setup() {

  //espHelper
  myESP.OTA_enable();
  myESP.OTA_setPassword(OTAPASSWORD);
  myESP.OTA_setHostname(NODENAME);
  myESP.begin();

#ifdef Sonoff
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, ledOFF);     //The Sonoff LED is low-true.  This starts with it off.
#endif

  pinMode(relayPin, OUTPUT);
  RelayControl(LOW);  //Start with the heat off

  pinMode(buttonPin, INPUT_PULLUP);

  Serial.begin(115200);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);

  //Save the initial switch position.
  currentVal = digitalRead(buttonPin);

  Serial.print("cmdTopic= ");
  Serial.println((String(cmdTopic)));
  Serial.print("statusTopic= ");
  Serial.println((String(statusTopic)));
  Serial.print("connectName= ");
  Serial.println((String(connectName)));
  Serial.println("...............");
}



/*
 * *************** LOOP ***********
   The loop function begins with making sure that your ESP is connected to the broker.
*/
void loop() {
  myESP.loop();  //run the loop() method - this keeps the network services running

  if (!client.connected()) {
    reconnect();
  }
  if (!client.loop())
    client.connect(connectName);


#ifdef toggle
  /*
   * ******** Toggle switch attached **********
  */
  //Has the switch position changed from the last loop?
  //If yes, the save the new setting and toggle the heat.
  switchVal = digitalRead(buttonPin);
  if (switchVal != currentVal) {
    delay(500);
    switchVal = digitalRead(buttonPin);
    if (switchVal != currentVal) {   //debounce
      currentVal = switchVal;
      relayState = !relayState;
      RelayControl(relayState);

      /*    //For simultaneous control over MQTT
            if(relayState){
                client.publish("studio/heat","on");
              }else{
                client.publish("worksgop/light","off");
              }
      */

    }
  }
#endif



#ifdef pushbutton
  /*
   * ***** Momentary pushbuttom switch attached *******
  */
  //When the switch input goes low, toggle the light.
  switchVal = digitalRead(buttonPin);
  if (switchVal == LOW) {
    delay(500);
    switchVal = digitalRead(buttonPin);
    if (switchVal == LOW) {   //debounce
      relayState = !relayState;
      RelayControl(relayState);
      delay(1000);            //Delay if the button is held too long.
    }
  }
#endif

  yield();
}

And here is Kaywinnet.h
#define ssid "Kaywinnet"
#define password "806194edb8"
#define mqtt_server "192.168.1.124"


user26916: 
Here's the ino file:
  ...
#define SSID "Kaywinnet"

...
  .ssid = SSID,

...
  And here is Kaywinnet.h
#define ssid "Kaywinnet"

...
  The error is on the .ssid= line.

C++ is case sensitive. You changed the macro name from SSID to ssid when you moved the defines to the .h file.

20713: <p>I'll post the whole code if you really need to see it, but my question is pretty simple.</p>

<p>In my sketch I define some parameters:</p>

<pre><code>#define SSID "Kaywinnet"
#define PASSWORD "806194edb8"
#define MQTT_SERVER { 192, 168, 1, 124 }
</code></pre>

<p>And, the sketch compiles just fine.
But, rather than putting my net parameters into every sketch, I wanted to just use a .h file so that if something changes, I only have to change it once.</p>

<p>Here's the problem.  When I put these three lines into a .h file, I get an error when the first parameter is used in the sketch:</p>

<pre><code>expected primary-expression before '.' token
</code></pre>

<p>Here is the code where I use the value:</p>

<pre><code>//Initialize ESPHelper
netInfo homeNet = {
  .mqttHost = mqtt_server,
  .mqttUser = "",
  .mqttPass = "",
  .mqttPort = 1883,
  .ssid = SSID,
  .pass = password
};
ESPHelper myESP(&amp;homeNet);
</code></pre>

<p>The error is on the .ssid= line.</p>

<p>So, why does it compile when I define the parameters in the sketch, and gives an error when I put them into a .h file??</p>

<p>Here's the ino file:</p>

<pre><code>    /*****

  Projects/esp8266/MQTT nodes/light2.ino
  10/3/2017- Clone of studio.ino

  IDE settings:
  Board: "Generic 8266 Module"
  Flash Mode: "DOUT"

*****/


#include &lt;ESP8266WiFi.h&gt;
#include &lt;PubSubClient.h&gt;
#include &lt;ESPHelper.h&gt;

//#include &lt;Kaywinnet.h&gt;
#define SSID "Kaywinnet"
#define password "806194edb8"
#define mqtt_server "192.168.1.124"

//#define toggle    //Using toggle switch.
#define pushbutton    //Using pushbutton switch


#define NODENAME "light2"
const char *cmdTopic =  NODENAME "/light";
const char *statusTopic = NODENAME "/light/status";
const char *connectName =  NODENAME "lights";
#define OTAPASSWORD "xxxx"



//Defaults to DHCP, if you want a static IP, configure below
//#define STATIC_IP
#ifdef STATIC_IP
IPAddress ip(192, 168, 1, 50);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
#endif



//Initialize ESPHelper
netInfo homeNet = {
  .mqttHost = mqtt_server,
  .mqttUser = "",
  .mqttPass = "",
  .mqttPort = 1883,
  .ssid = SSID,
  .pass = password
};
ESPHelper myESP(&amp;homeNet);


//Declare an object of class WiFiClient
WiFiClient esplight2;
PubSubClient client(esplight2);


#define esp8266-01    //Either sonoff or esp8266-01

//Define the GPIO pins on the 8266-01
#ifdef esp8266-01
const int buttonPin = 0;    //GPIO0
const int relayPin = 2;     //GPIO2
#endif

#ifdef Sonoff
const int buttonPin = 0;     //GPIO0
const int extraPin = 14;
const int ledPin = 13;
const int relayPin = 12;
const bool ledOFF = HIGH;
const bool ledON = LOW;
#endif

int switchVal = 0;
int currentVal = 0;
bool relayState;
String payLoad;


// * *************** RelayControl, remember the state ***************
//
void RelayControl(bool state) {
  //Serial.print("relayState: ");
  //Serial.println(relayState);

  digitalWrite(relayPin, state ? HIGH : LOW);
  relayState = state;

  //Feedback over MQTT
  if (relayState) {
    client.publish(statusTopic, "on");    //Tell Node Red about the current status
    Serial.println(String(statusTopic) + "= on.");
  } else {
    client.publish(statusTopic, "off");
    Serial.println(String(statusTopic) + "= off.");
  }
  Serial.println();
}



void timeLoop (long int startMillis, long int interval) { // the delay function
  while (millis() - startMillis &lt; interval) {}
}




/*
 * ************** blink the LED ************************
   We assume the LED is on after connecting.
*/
void blinkLED() {
#ifdef esp8266-01
  return;   //No led on the esp to blink..
#endif
#ifdef Sonoff
  digitalWrite(ledPin, ledOFF);
  delay(500);
  digitalWrite(ledPin, ledON);
#endif
}




/*
 * ******************** set up WiFi ****************
*/
void setup_wifi() {
  delay(10);
  // We start by connecting to a WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(SSID);

  //Connect to WiFi network so we can reach the MQTT broker and publish messages to topics.
  WiFi.mode(WIFI_STA);
  WiFi.begin(SSID, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("WiFi connected - ESP IP address: ");
  Serial.println(WiFi.localIP());
}



/*
 * *************** MQTT callback ********************
*/
void callback(String topic, byte* message, unsigned int length) {
  Serial.print("Message arrived on topic: ");
  Serial.print(topic);
  Serial.print(". Message: ");

  String messageTemp;
  for (int i = 0; i &lt; length; i++) {
    //Serial.print((char)message[i]);
    messageTemp += (char)message[i];
  }
  messageTemp.trim();            // trim the white space off the string

  Serial.println(messageTemp);

  // If a message is received with the topic 'cmdTopic', check if the message is either on or off.
  if (topic == cmdTopic) {
    if (messageTemp == "on") {
      Serial.println("Light2 is ON");
      RelayControl(HIGH);
      blinkLED();

    }
    else if (messageTemp == "off") {
      Serial.println("Light2 is OFF");
      RelayControl(LOW);
      blinkLED();

    }
  }
}





/*
 * **************** Connect to MQTT broker **************
   This functions reconnects your ESP8266 to the MQTT broker and subscribes to topics.
*/
void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");

    // Attempt to connect
    if (client.connect(connectName)) {
      Serial.println("connected");
#ifdef Sonoff
      digitalWrite(ledPin, ledON);
#endif
      // Subscribe or resubscribe to a topic
      client.subscribe(cmdTopic);
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      delay(5000);
    }
  }
}





/*
 * *************** SETUP ********************
*/
void setup() {

  //espHelper
  myESP.OTA_enable();
  myESP.OTA_setPassword(OTAPASSWORD);
  myESP.OTA_setHostname(NODENAME);
  myESP.begin();

#ifdef Sonoff
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, ledOFF);     //The Sonoff LED is low-true.  This starts with it off.
#endif

  pinMode(relayPin, OUTPUT);
  RelayControl(LOW);  //Start with the heat off

  pinMode(buttonPin, INPUT_PULLUP);

  Serial.begin(115200);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);

  //Save the initial switch position.
  currentVal = digitalRead(buttonPin);

  Serial.print("cmdTopic= ");
  Serial.println((String(cmdTopic)));
  Serial.print("statusTopic= ");
  Serial.println((String(statusTopic)));
  Serial.print("connectName= ");
  Serial.println((String(connectName)));
  Serial.println("...............");
}



/*
 * *************** LOOP ***********
   The loop function begins with making sure that your ESP is connected to the broker.
*/
void loop() {
  myESP.loop();  //run the loop() method - this keeps the network services running

  if (!client.connected()) {
    reconnect();
  }
  if (!client.loop())
    client.connect(connectName);


#ifdef toggle
  /*
   * ******** Toggle switch attached **********
  */
  //Has the switch position changed from the last loop?
  //If yes, the save the new setting and toggle the heat.
  switchVal = digitalRead(buttonPin);
  if (switchVal != currentVal) {
    delay(500);
    switchVal = digitalRead(buttonPin);
    if (switchVal != currentVal) {   //debounce
      currentVal = switchVal;
      relayState = !relayState;
      RelayControl(relayState);

      /*    //For simultaneous control over MQTT
            if(relayState){
                client.publish("studio/heat","on");
              }else{
                client.publish("worksgop/light","off");
              }
      */

    }
  }
#endif



#ifdef pushbutton
  /*
   * ***** Momentary pushbuttom switch attached *******
  */
  //When the switch input goes low, toggle the light.
  switchVal = digitalRead(buttonPin);
  if (switchVal == LOW) {
    delay(500);
    switchVal = digitalRead(buttonPin);
    if (switchVal == LOW) {   //debounce
      relayState = !relayState;
      RelayControl(relayState);
      delay(1000);            //Delay if the button is held too long.
    }
  }
#endif

  yield();
}
</code></pre>

<p>And here is Kaywinnet.h</p>

<pre><code>#define ssid "Kaywinnet"
#define password "806194edb8"
#define mqtt_server "192.168.1.124"
</code></pre>
 26916: <blockquote>
  <p>Here's the ino file:<br>
  ...</p>

<pre><code>#define SSID "Kaywinnet"
</code></pre>
  
  <p>...</p>

<pre><code>  .ssid = SSID,
</code></pre>
  
  <p>...<br>
  And here is Kaywinnet.h</p>

<pre><code>#define ssid "Kaywinnet"
</code></pre>
  
  <p>...<br>
  The error is on the .ssid= line.</p>
</blockquote>

<p>C++ is case sensitive. You changed the macro name from <code>SSID</code> to <code>ssid</code> when you moved the defines to the .h file.</p>
