I'm making a function in Qt that is going to print out different things depending on a key it receives. 

I have stored the keys to compare with in a separate headerfile, in a separate namespace called **reference**. 
The switch statement only wants to "see" the uninitialized declaration of the key and therefore thinks that I'm comparing with a non-constant value. 
However I'm not, as the value really is initialized in the namespace's source file. And I off course cannot initialize my keys in the header, as that will create multiple definitions. 

**How do I "tell" my switch-case that I actually have initialized the keys I'm comparing with?** 

```
void MainWindow::printOuts(char key, float value)
{

    const int test1 =2;
    const int test2 = (const int)reference::potentiometer;
    const char test3= reference::potentiometer;
     const char test4 =0;

 //const char potentiometer lies in a namespace called reference

    if(key==reference::potentiometer)
    {//works
        qDebug()<<"Got a potentiometer value!!";

    }

    switch (key)
    {
        case test1: //Works ok
        case test2: //gives "cannot appear in a constant-expression"
        case test3: ////gives "cannot appear in a constant-expression"
        case test4: //Works ok
    }

}

```