I'm developing an application using statistical attacks to crack wep keys.
When I compile with my makefile (above) I get this error :
ld: can't link with a main executable file 'execStatAttack' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation) make: * [statAttack] Error 1
My project contain those files :
statAttack.cpp : contain the main function, uses files above
rc4.h + rc4.cpp : with those function
#include <iostream> #include <stdlib.h> #include <stdio.h #include <vector #ifndef RC4 #define RC4 using namespace std int* rc4(int); int random_byte(); vector<int> cipher_mess_seq (long, int); #endif
- bias.h + bias.cpp :
#include <iostream> #include <stdlib.h> #include <stdio.h> #include <utility> #include <fstream> #include <vector> #include <string> #ifndef BIAIS #define BIAIS using namespace std; typedef pair<int,double> IntegerDoublePair; vector<IntegerDoublePair> get_bias (string, int); int compareTo (double, double); vector<IntegerDoublePair> get_all_biases(string); #endif
- and the makefile :
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 $< clean : rm -f $(OBJ_FILES_NAIVE) $(OBJ_FILES_STATALGO) mrproper: clean rm -rf $(EXEC_NAME_NAIVE) $(EXEC_NAME_STATALGO)
this is my configuration (terminal) :
==> g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
So i would like your help, to find out why this error appeared.
Thanks.
#include <vector
andusing namespace std
- you will need to fix these and any other similar mistakes to have a chance of compiling the code. – Paul Rbias
bias
instead of also usingbiais
in some places. Is there more to the error than what you pasted? – Etan Reisner