title: SFML and Visual C++ 11:Error: error C2065: '' : undeclared identifier
body: <p>I am a new visual c++ and SFML user (11). I was making a tiled platformer.</p>
  
  <p>There was an "Enemy" class in my project. I was reading the map from something like that:
  string levelOne [14] = {/* ... */};</p>
  
  <p>And when I tried to use the variable levelOne I got an error that it is an undeclared identifier. I tried initializating the variable in the header file
  , where I needed levelOne and not including the header with the variable, but I got the same error. And when I was making a very similar function of a Player class, it worked!But not with the Enemy class.
  Files:
  main.cpp
  Headers:
  player.h (with an inline Player class)
  platform.h (with an inline Platform class)
  enemy.h (with an inline Enemy class and two stupid errors about undeclared identifiers)
  maps.h (with the levelOne variable and some functions for setting up the level)</p>
  
  <pre><code>//Enemy.h
  #pragma once
  #ifndef ENEMY_H
  #define ENEMY_H
  #include "SFML\Graphics.hpp"
  #include "maps.h"
  class Enemy {
      public:
          //...
  void checkCollisionByX(){
  
      for (int i = 0;i &lt; 14;i++)
      {
          for (int j = 0;j &lt; 86; j++)
          {
              if (levelOne[i][j] == '-'){
                  if (!standing){
                  if (right){
                      if (((j * 50 &lt;= x + width) &amp;&amp; (x + width &lt;= j * 50 + 50)) &amp;&amp; (((i * 50 &lt;= y) &amp;&amp; (y &lt;= i * 50 + 50)) || ((i * 50 &lt;= y + height) &amp;&amp; (y + height &lt;= i * 50 + 50)))){
                          x = x - (x + width - j*50);
                          left = true;
                          right = false;
                          return;
                      }
                  } else if (left){
                      if (((j * 50 &lt;= x) &amp;&amp; (x &lt;= j * 50 + 50)) &amp;&amp; (((i * 50 &lt;= y) &amp;&amp; (y &lt;= i * 50 + 50)) || ((i * 50 &lt;= y + height) &amp;&amp; (y + height &lt;= i * 50 + 50)))){
                          x = x + (j*50 + 50 - x);
                          left = false;
                          right = true;
                          return;
                      }
                  }
                  }
              }
          }
      }
  }
  bool checkCollisionByY(){
      bool onground = false;
      for (int i = 0;i &lt; 14;i++)
      {
          for (int j = 0;j &lt; 86; j++)
          {
              if (levelOne[i][j] == '-'){
                  if (((j * 50 &lt;= x + width / 2) &amp;&amp; (x + width / 2 &lt;= j * 50 + 50)) &amp;&amp; ((i * 50 &lt;= y + height) &amp;&amp; (y + height &lt;= i * 50 + 50))){
                      y = y - (y + height - i * 50) - 2;
                      onground = true;
                  }
                  if (((j * 50 &lt;= x + width / 2) &amp;&amp; (x + width / 2 &lt;= j * 50 + 50)) &amp;&amp; ((i * 50 &lt;= y) &amp;&amp; (y &lt;= i * 50 + 50))){
                      y = y + (y - (i*50 + 50));
                  }
              }
          }
      }
      return onground;
  }
      private:
      float x, y, speed;
      int animCount, width, height;
      bool right, left, standing, onGround;
      sf::Texture texture;
      sf::Sprite sprite;
  }
  #endif ENEMY_H
  </code></pre>
  
  <p>maps.h</p>
  
  <pre><code>#pragma once
  
  #ifndef MAPS_H
  #define MAPS_H
  
  #include &lt;SFML\Graphics.hpp&gt;
  #include "platform.h"
  #include "enemy.h"
  using namespace std;
  
  Platform platformss [10000];
  Enemy enemiess [250];
  string levelOne [14] = {"-------------------------------------------------                            -------------------------------------",
  "-                              ---          -        -                               -",
  "-                             -            ---      ---                              -",
  "-                              ---          -        -                               -",
  "-                                                                                    -",
  "-                                                                                    -",
  "-                                                                                    -",
  "-                                     E                                              -",
  "-                   -- -- -- -- -- -- -- -- -- -- -- -- -- -- --                     -",
  "-               --                                               --                  -",
  "-             -                                                    -                 -",
  "-            --                                     -               --               -",
  "-           ---      E        -    --       E       -        E                       -",
  "--------------------------------------------------------------------------------------"};
  
  
  int setupLevelOne(){
  /* ... */
  }
  int getEnemyNumber(){
      /* ... */
  }
  
  #endif MAPS_H
  </code></pre>
  
  <p>Build output:</p>
  
  <pre><code>1&gt;------ Build started: Project: SFML PRACTICE, Configuration: Debug Win32         ------
  1&gt;Build started 09.08.2019 21:18:06.
  1&gt;ClCompile:
  1&gt;  main.cpp
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-        32\include\kostya_test_project\c++\hellosfml\hellosfml\enemy.h(82): error C2065: 'levelOne' : undeclared identifier
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\enemy.h(110): error C2065: 'levelOne' : undeclared identifier
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\maps.h(34): warning C4018: '&lt;' : signed/unsigned mismatch
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\maps.h(55): warning C4018: '&lt;' : signed/unsigned mismatch
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\player.h(116): warning C4018: '&lt;' : signed/unsigned mismatch
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\player.h(140): warning C4018: '&lt;' : signed/unsigned mismatch
  1&gt;c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\main.cpp(30): warning C4244: 'initializing' : conversion from 'sf::Int32' to 'float', possible loss of data
  1&gt;
  1&gt;Build FAILED.
  1&gt;
  1&gt;Time Elapsed 00:00:00.87
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>The errors:</p>
  
  <pre><code>Error   1   error C2065: 'levelOne' : undeclared identifier c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\enemy.h    82  1   SFML PRACTICE
  Error   2   error C2065: 'levelOne' : undeclared identifier c:\users\suzer\appdata\local\programs\python\python35-32\include\kostya_test_project\c++\hellosfml\hellosfml\enemy.h    110 1   SFML PRACTICE
  </code></pre>
  
  <p>Such stupid errors!Why can't it see the "string levelOne[14] ..."
  And how do I fix them?</p>
  
  <p>Thank you.</p>