title: Main function in .lib as startup function?
body: <p>I want to do something like this:</p>
  
  <p>library.h</p>
  
  <pre><code>#define main ClientMain
  </code></pre>
  
  <p>libary.cpp</p>
  
  <pre><code>#define main ClientMain
  extern "C" int main (int argc, char *argv[], char *envp[]);
  
  #ifdef WINDOWS
  int WINAPI WinMain()
  {
    // other code here
    ClientMain(0, 0, 0);
  }
  #endif
  </code></pre>
  
  <p>client.cpp // platform independent code</p>
  
  <pre><code>#include library.h
  int main(int argc, char* argv[]){ // stuff}
  </code></pre>
  
  <p>However, I keep getting the error:
  MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol <em>main referenced in function _</em>_tmainCRTStartup</p>
  
  <p>Any idea what I am doing wrong?</p>