Like Tree2Likes

Problem with library

This is a discussion on Problem with library within the C++ Programming forums, part of the General Programming Boards category; Hello, im programmin for like 2 years so idecided to use some libraries from net. I want to make simple ...

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    11

    Problem with library

    Hello, im programmin for like 2 years so idecided to use some libraries from net. I want to make simple sniffer, i found winpcap (im using windows), installed it, but i got no idea how to use those libararies. when i #include<pcap.h> it says " pcap.h: No such file or directory. "

    Im totally green never before used new library

    Instalation process was 3 clicks OK OK OK, it didnt generate and .h or .cpp files, maybe im doing something wrong?

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    134
    Have you searched for this file in your system! Have you googled it!
    Even though not solved, look something simillar to your problem:
    winPcap
    S_ccess is waiting for u. Go Ahead, put u there.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Yes i was looking in google, i didnt find anything useful. After installing WinPcap 4.1.2 where are those libraries? Or i can simply include them BUT i just made something wrong? Or i should use other compiler? Other program to write my sources?

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,422
    You need to set up include paths for your compiler. Include paths tell the compiler where to look for header files, etc.
    This process depends on what compiler you use.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    I have never before used other libraries so i dont really know what u mean. By the way im using some poor program/complier, which one (free) do u recommned? And if its possible tell me how to set it
    Last edited by QQemka; 07-03-2012 at 07:49 AM.

  6. #6
    Registered User
    Join Date
    Jun 2011
    Posts
    2,219
    The Code::Blocks IDE comes with mingw - as for how to set it up...

  7. #7
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Thanks for fast reply i will check it

    And is it normal that after library instalation i dont have any .h files?
    Last edited by QQemka; 07-03-2012 at 08:12 AM.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,403
    Quote Originally Posted by QQemka
    And is it normal that after library instalation i dont have any .h files?
    Well... create a project, then compile and run this program:
    Code:
    #include <iostream>
    
    int main()
    {
        std::cout << "Hello world!" << std::endl;
    }
    If all is fine and dandy with a "Hello world!" output, then it is normal. Otherwise, something is wrong.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    If you just went to here -> WinPcap · Download and got the first thing you found
    Version 4.1.2 Installer for Windows
    Driver +DLLs
    Then you got the wrong thing (actually, you may need it anyway)


    What you really need if you want to compile and build your own customisations on top of pcap is
    WinPcap · Developer Resources
    Download WinPcap 4.1.2 Developer's Pack
    MD5 Checksum: bae2236af062b0900ad1416b2c4878b9
    SHA1 Checksum: f5c80885bd48f07f41833d0f65bf85da1ef1727a

    The library files seem to be compiled on the assumption that you're using some recent version of visual studio.

    If you have another compiler, then you'll need to get the corresponding source code and compile that yourself.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    I solved the problem. Maybe i ask some questions later
    Last edited by QQemka; 07-03-2012 at 10:09 AM.

  11. #11
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Im using codeblocks, when im trying to compile simple programs from tutorial WinPcap: Obtaining the device list im gettin errors

    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c|4|warning: return type defaults to 'int'|
    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c||In function 'main':|
    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c|11|warning: implicit declaration of function 'pcap_findalldevs_ex'|
    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c|11|error: 'PCAP_SRC_IF_STRING' undeclared (first use in this function)|
    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c|11|error: (Each undeclared identifier is reported only once|
    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c|11|error: for each function it appears in.)|
    C:\Documents and Settings\QQemka\Pulpit\qqqqqqq\sn.c|30|warning: 'return' with no value, in function returning non-void|
    ||=== Build finished: 3 errors, 3 warnings ===|


    Is it possible that this library cannot complie in codeblocks??
    All i need is to write simple sniffer showing packets coming to and out of application, with ability to send some modified packets
    Last edited by QQemka; 07-03-2012 at 11:05 AM.

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,422
    Why are you using C on the C++ board?
    (I assume that sn.c is your file?)
    It would help if you post your code, too.
    Last edited by Elysia; 07-03-2012 at 11:24 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    I tried to compile both with c and c++ same error.
    But why compiler says he doesnt know the function? After unpacking winpcap i found pcap.h and told the compiler path to it.

    Maybe u know any other easier packet library, im using windows xp, codeblocks, im programming in c++

  14. #14
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    Well either you didn't include #include "pcap.h"

    Or you did #include "pcap.h", and there is another error message (not shown) which is "file not found".

    What you also need to do is in code blocks, find something like
    project->settings->compiler
    Here you should see something along the lines of "additional pre-processor include directories"

    Similarly, for
    project->settings->linker
    you should see additional library directories and additional libraries.

    These fields need to be set up with the paths and filenames of where you managed to unzip the package you downloaded.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  15. #15
    Registered User
    Join Date
    May 2009
    Posts
    2,507
    Quote Originally Posted by Salem View Post
    Well either you didn't include #include "pcap.h"

    Or you did #include "pcap.h", and there is another error message (not shown) which is "file not found".

    What you also need to do is in code blocks, find something like
    project->settings->compiler
    Here you should see something along the lines of "additional pre-processor include directories"

    Similarly, for
    project->settings->linker
    you should see additional library directories and additional libraries.

    These fields need to be set up with the paths and filenames of where you managed to unzip the package you downloaded.
    To expand on Salem post with info from the Code::Blocks FAQs

    From FAQ-Compiling (general) - CodeBlocks

    For your project :
    - Right click on the project then select Build options
    - Select the directories tab
    - Add the required paths for compiler and linker.
    - Add your specific libraries in the linker tab.
    - Pay attention to project settings and target settings.
    Tim S.
    Last edited by stahta01; 07-03-2012 at 12:57 PM.
    Salem likes this.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Library Problem
    By evetevet in forum C Programming
    Replies: 4
    Last Post: 01-18-2009, 10:07 AM
  2. library problem again!!!
    By kris.c in forum C Programming
    Replies: 8
    Last Post: 07-13-2006, 06:23 AM
  3. problem with the library
    By kris.c in forum C Programming
    Replies: 21
    Last Post: 07-10-2006, 08:29 PM
  4. BZ2 library problem
    By cfrost in forum C Programming
    Replies: 0
    Last Post: 12-20-2004, 10:53 PM
  5. Library Problem - [I Think]
    By White Chocobo in forum C Programming
    Replies: 1
    Last Post: 04-25-2002, 08:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21