title: g++ : can't link with a main executable file
body: <p>I'm developing an application using statistical attacks to crack wep keys.</p>
  
  <p>When I compile with my makefile (above) I get this error : </p>
  
  <blockquote>
    <p>ld: can't link with a main executable file 'execStatAttack' for
    architecture x86_64</p>
    
    <p>clang: error: linker command failed with exit code 1 (use -v to see
    invocation) make: <em>*</em> [statAttack] Error 1</p>
  </blockquote>
  
  <p>My project contain those files : </p>
  
  <ul>
  <li><p>statAttack.cpp : contain the main function, uses files above</p></li>
  <li><p>rc4.h + rc4.cpp : with those function</p></li>
  </ul>
  
  <blockquote>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h
  #include &lt;vector
  
  #ifndef RC4
  #define RC4
  
  using namespace std
  int* rc4(int);
  int random_byte();
  vector&lt;int&gt; cipher_mess_seq (long, int);
  
  #endif
  </code></pre>
  </blockquote>
  
  <ul>
  <li>bias.h + bias.cpp : </li>
  </ul>
  
  <blockquote>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;utility&gt;
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  
  #ifndef BIAIS
  #define BIAIS
  
  using namespace std;
  
  typedef pair&lt;int,double&gt; IntegerDoublePair;
  vector&lt;IntegerDoublePair&gt; get_bias (string, int);
  int compareTo (double, double);
  vector&lt;IntegerDoublePair&gt; get_all_biases(string);
  
  #endif
  </code></pre>
  </blockquote>
  
  <ul>
  <li>and the makefile : </li>
  </ul>
  
  <blockquote>
  <pre><code>CC = g++
  CFLAGS = -Wall -g
  LDFLAGS = -lm 
  EXEC_NAME_NAIVE = execNaiveAttack
  EXEC_NAME_STATALGO = execStatAttack
  OBJ_FILES_NAIVE = naiveAttack.o biais.o rc4.o
  OBJ_FILES_STATALGO = statAttack.o biais.o rc4.o
  
  naiveAttack : $(EXEC_NAME_NAIVE)
  
  statAttack : $(EXEC_NAME_STATALGO)
  
  $(EXEC_NAME_NAIVE) : $(OBJ_FILES_NAIVE)
     $(CC) $(OBJ_FILES_NAIVE) $(LDFLAGS) -o $(EXEC_NAME_NAIVE)
  
  $(EXEC_NAME_STATALGO) : $(OBJ_FILES_STATALGO)
     $(CC) $(OBJ_FILES_STATALGO) $(LDFLAGS) -o $(EXEC_NAME_STATALGO)
  
  %.o : %.cpp
     $(CC) $(CFLAGS) -o $@ -c $&lt;
  
  clean :
     rm -f $(OBJ_FILES_NAIVE) $(OBJ_FILES_STATALGO)
  
  mrproper: clean
     rm -rf $(EXEC_NAME_NAIVE) $(EXEC_NAME_STATALGO)
  </code></pre>
  </blockquote>
  
  <p>this is my configuration (terminal) : </p>
  
  <blockquote>
    <p>==> g++ --version</p>
    
    <p>Configured with:
    --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1</p>
    
    <p>Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)</p>
    
    <p>Target: x86_64-apple-darwin13.1.0</p>
    
    <p>Thread model: posix</p>
  </blockquote>
  
  <p>So i would like your help, to find out why this error appeared.</p>
  
  <p>Thanks.</p>