Windows compiler libnet

Source: Internet
Author: User
Tags windows visual

> 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.