> Following compilation based on Windows Visual Studio 2013
Download Libnet0.10.11.zip from Souceforge
http://sourceforge.net/projects/libnet/files/libnet/
After extracting the directory structure:
Source files in the Lib directory;
Batfiles is a compiled script
Msvcmake.bat
@echo offREMFirst set up the helper batch filesCDBatfilesCopyMsvcobj.bat obj.BatCopyMsvclib.bat Lib.BatCopyMsvcexe.bat exe.BatREMNow do the generic buildif"%1" = = ""Goto AllGoto %1: AllPagerMakeallGoto End: LibPagerMakelibGoto End: TestsPagermaketestGoto End: ExamplesPagerMakeexGoto End: EndCD..
Msvcobj.bat
@echo off /dtarget_msvc/MD%1. c/fo%1. obj
Msvclib.bat
@echo off /nodefaultlib/out:%1%2%3. obj
Msvcexe.bat
@echo off /dtarget_msvc/MD%1. C.. /lib/libnet.lib Wsock32.lib
--------------Compilation Method---------------
1. Copy the Msvcmake.bat under the Batfile directory to the Upper directory (libnet) and double-click Run.
Generates obj.bat,lib.bat,exe.bat three files in the Batfiles directory.
However, you are prompted that CL is not an internal or external command. This article applies to Vs2013,cl.exe in the following directory:
2. C:\Program Files (x86) \microsoft The C compiler's path to Visual Studio 12.0\vc\bin;
Added to the environment variable path.
3. new environment variable include
Add the following two paths into the include:
C:\Program Files (x86) \microsoft Visual Studio 12.0\vc\include
C:\Program Files (x86) \microsoft Sdks\windows\v7.1a\include
4. new environment variable Lib
Add the following two environment variables into the lib:
C:\Program Files (x86) \microsoft Visual Studio 12.0\vc\lib
C:\Program Files (x86) \microsoft Sdks\windows\v7.1a\lib
5. Double-click Make.bat to successfully compile the Libnet.lib library
The obj file was generated under the core and drivers directories.
-------------Use-------------------
Place Inlcude/libnet.h and Lib/libnet.lib separately in
C:\Program Files (x86) \microsoft Visual Studio 12.0\vc\include and
C:\Program Files (x86) \microsoft in the Visual Studio 12.0\vc\lib directory
Then explicitly invoke the related library in your code:
#pragma comment (lib, "Libnet.lib")#pragma comment (lib, "Wsock32.lib")
Windows compiler libnet