title: Compiling differences in Visual C++ and *nix environments
body: <p>Is there a difference between compiling projects in *nix environments and MS Visual C++?
  For example, there is a "stdafx.h" file in Visual C++.</p>
  
  <p>The reason I'm asking is that I submitted a piece of code which compiled in g++, to <a href="http://refactormycode.com/codes/957-breadth-first-search-textbook-example" rel="nofollow noreferrer">refactormycode.com</a>.  Then after it got a refactoring, it seemed to include a "stdafx.h", so I figured I'll download Visual C++ 2008 Express but I can't seem to get it to build.</p>
  
  <p>What I'm doing is creating a new project > Create a Win32 Console Application, and replacing the auto-generated .cpp with the refactored code. Am I doing something wrong here?</p>
  
  <p>This is the compiler errors I'm getting:</p>
  
  <pre><code>------ Build started: Project: bfs, Configuration: Debug Win32 ------
  Compiling...
  bfs.cpp
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(3) : error C2871: 'std' : a namespace with this name does not exist
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(8) : error C2143: syntax error : missing ';' before '&lt;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(8) : error C2238: unexpected token(s) preceding ';'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(25) : error C2143: syntax error : missing ';' before '&amp;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(26) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(28) : warning C4183: 'getEdges': missing return type; assumed to be a member function returning 'int'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(32) : error C2059: syntax error : '&lt;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(32) : error C2238: unexpected token(s) preceding ';'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(12) : error C2758: 'Vertex::Edges' : must be initialized in constructor base/member initializer list
          c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(25) : see declaration of 'Vertex::Edges'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(22) : error C2065: 'm_edges' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(22) : error C2228: left of '.push_back' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(27) : error C2065: 'm_edges' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C2143: syntax error : missing ';' before '&lt;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C2039: 'iterator' : is not a member of '`global namespace''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C2238: unexpected token(s) preceding ';'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(41) : error C2059: syntax error : '&lt;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(41) : error C2238: unexpected token(s) preceding ';'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(83) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(83) : error C2143: syntax error : missing ';' before '&amp;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(84) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(86) : warning C4183: 'getVertices': missing return type; assumed to be a member function returning 'int'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(89) : error C2146: syntax error : missing ';' before identifier 'm_vertices'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(89) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(89) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(43) : error C2758: 'Graph::Vertices' : must be initialized in constructor base/member initializer list
          c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(83) : see declaration of 'Graph::Vertices'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(55) : error C2065: 'm_vertices' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(55) : error C2228: left of '.insert' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(61) : error C2065: 'VertexIterator' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(61) : error C2146: syntax error : missing ';' before identifier 'iter'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(61) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'm_vertices' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2228: left of '.begin' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'm_vertices' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2228: left of '.end' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(64) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(64) : error C2227: left of '-&gt;getId' must point to class/struct/union/generic type
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(65) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(78) : error C2065: 'VertexIterator' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(78) : error C2146: syntax error : missing ';' before identifier 'iter'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(78) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'm_vertices' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2228: left of '.begin' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'm_vertices' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2228: left of '.end' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(80) : error C2065: 'iter' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(80) : error C2541: 'delete' : cannot delete objects that are not pointers
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(85) : error C2065: 'm_vertices' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(119) : error C2143: syntax error : missing ';' before '&lt;'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(119) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(119) : error C2238: unexpected token(s) preceding ';'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(106) : error C2065: 'UINT_MAX' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(138) : error C2065: 'queue' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(138) : error C2059: syntax error : 'const'
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(140) : error C2065: 'Attributes' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(142) : error C2065: 'q' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(142) : error C2228: left of '.push' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(143) : error C2065: 'q' : undeclared identifier
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(143) : error C2228: left of '.empty' must have class/struct/union
          type is ''unknown-type''
  c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(143) : fatal error C1903: unable to recover from previous error(s); stopping compilation
  Build log was saved at "file://c:\Users\Admin\Documents\Visual Studio 2008\Projects\alg\bfs\bfs\Debug\BuildLog.htm"
  bfs - 66 error(s), 2 warning(s)
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>