tutorials.de Buch-Aktion 05/2012
Seite 1 von 2 12 LetzteLetzte
ERLEDIGT
NEIN
ANTWORTEN
16
ZUGRIFFE
1000
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Amarr Tutorials.de Gastzugang
    Hallo,
    ich sitze zur Zeit an einem Schulprojekt und zwar muss ich einen IP und Portscanner in C++ programmieren.
    Da meine Vorkenntnisse nicht so überragend sind hänge ich im Moment an einem Problem fest und weis einfach nicht mehr weiter.

    Ich benutze zum Programmieren Eclipse IDE for C/C++ und MinGW, mein OS ist Windows7 32bit.

    Mein Problem ist nun, dass ich obwohl libws2_32.a und libiphlpapi.a über den linker eingebunden sind immernoch die Fehlermeldung

    workspace/win/Debug/../win.cpp:109: undefined reference to `IcmpCreateFile@0'

    bekomme. Hier mal meinem Quellcode:

    #include <windows.h>
    #include <stdio.h>
    #include <winsock2.h>
    #include <io.h>
    #include <string.h>
    #include <iostream>
    #include <iphlpapi.h>
    #include <ipexport.h>
    #include "icmpapi.h" // Da die icmpapi.h nicht dabei war habe ich sie von http://www.koders.com/c/fidB304BDC30...px?s=windows.h genommen.

    using namespace std;

    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);

    void IntToString(int i, char* buffer)
    {
    sprintf(buffer, "%d", i);
    }

    int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szComLine, int iCmdShow){
    char szName[] = "Fenster";
    char szTitel[] = "ScanU";

    int xPos = 0;
    int yPos = 0;
    int xSize = 600;
    int ySize = 400;
    HBRUSH bgColor = CreateSolidBrush(RGB(180,120,90));
    WNDCLASS wc;

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hI;
    wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = bgColor;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = szName;

    RegisterClass (&wc);

    HWND hwnd = CreateWindow (szName, szTitel, WS_OVERLAPPEDWINDOW, xPos, yPos, xSize, ySize, NULL, NULL, hI, NULL);
    HWND BCX_Listbox(char*,HWND,int,int,int,int,int,int=0,int=-1);
    ShowWindow (hwnd, iCmdShow);
    UpdateWindow (hwnd);

    MSG msg;
    while(GetMessage (&msg, NULL, 0, 0)){
    TranslateMessage (&msg);
    DispatchMessage (&msg);
    }
    return msg.wParam;
    }

    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
    HDC hdc;
    PAINTSTRUCT ps;
    static HWND hwndButton1, hwndButton2, sIP, eIP, sPort, ePort, list1, list2;
    char vIP[16], bIP[16];
    struct sockaddr_in addr;
    unsigned long start, end, temp;

    HANDLE IcmpFile;
    DWORD ReturnValue = 0;
    char SendData[] = "Ping";
    LPVOID ReplyBuffer = NULL;
    DWORD ReplySize = 0;

    switch (message){
    case WM_PAINT:
    hdc = BeginPaint (hwnd, &ps);
    SetTextColor(hdc,RGB(0,0,0));
    SetBkColor(hdc,RGB(180,120,90));
    TextOut (hdc, 37, 10, "Start IP:", 9);
    TextOut (hdc, 42, 30, "End IP:", 7);
    TextOut (hdc, 400, 10, "Start Port:", 11);
    TextOut (hdc, 405, 30, "End Port:", 9);
    EndPaint (hwnd, &ps);
    return (0);
    case WM_CREATE:
    hwndButton1 = CreateWindow ("button", "Netz Scannen", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 250, 50, 100, 20, hwnd, (HMENU)1,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
    hwndButton2 = CreateWindow ("button", "Ports Scannen", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 250, 180, 100, 20, hwnd, (HMENU)2,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
    sIP = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 92,10,110,18, hwnd, (HMENU)3, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
    eIP = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 92,30,110,18, hwnd, (HMENU)4, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
    sPort = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 470,10,50,18, hwnd, (HMENU)5, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
    ePort = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 470,30,50,18, hwnd, (HMENU)6, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
    list1 = CreateWindow ("listbox", "",WS_CHILD | WS_VISIBLE | LBS_STANDARD, 30, 75, 200, 250, hwnd, (HMENU)7,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE) , NULL);
    list2 = CreateWindow ("listbox", "",WS_CHILD | WS_VISIBLE | LBS_STANDARD, 370, 75, 200, 250, hwnd, (HMENU)8,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE) , NULL);
    return (0);
    case WM_COMMAND:
    switch(LOWORD(wParam)){
    case 1:
    GetWindowText(sIP,vIP,16);
    GetWindowText(eIP,bIP,16);
    SendMessage(list1, LB_RESETCONTENT, 0, 0);
    start = ntohl(inet_addr(vIP));
    end = ntohl(inet_addr(bIP));
    if (start > end){
    temp = start;
    start = end;
    end = temp;
    }
    for(temp = start; temp <= end; temp++){
    addr.sin_addr.s_addr = htonl(temp);
    IcmpFile = IcmpCreateFile();

    SendMessage(list1, LB_ADDSTRING, NULL, (LPARAM)inet_ntoa(addr.sin_addr));
    }
    break;
    case 2:
    break;
    }
    return(0);
    case WM_DESTROY:
    PostQuitMessage (0);
    return (0);
    }
    return DefWindowProc (hwnd, message, wParam, lParam);
    }

    Ich weis, das man das noch schöner gestallten könnte, aber es erfüllt seinen Zweck. Das Programm ist (soll) eigendlich ganz simpel sein, man gibt die erste und die letzte IP des zu scannenden Bereiches ein und er scannt alles was dazwischen ist und gibt die erreichten IPs in einer liste aus.
    Zur Hilfe nehme ich http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx aber ich bekomme dieses Problem im Moment nicht gelöst, ein Schulkollege meint es könnte an der library liegen.

    Habt ihr vielleicht eine Idee wo der fehler ist?
     

  2. #2
    Avatar von ComFreek
    ComFreek ComFreek ist offline [x] Let it be logic!
    tutorials.de Moderator
    Registriert seit
    Jun 2009
    Beiträge
    2.358
    Blog-Einträge
    4
    Bitte poste deinen Code formatiert!
     
    mfg ComFreek

    Falls ich dir geholfen habe, würde ich mich über ein DANKE freuen!
    Kenn mich am besten aus in C++, WEB-Sprachen (PHP, HTML, JavaScript) und vllt. mehr
    [PHP] Überprüfen, ob Website erreichbarSicherheit in PHP-Codes schaffenGoogle Chrome-Extension für tutorials.dejson_compress()

  3. #3
    Amarr Tutorials.de Gastzugang
    Das war er ursprünglich, ich weis blos nicht ob das geht wenn man nicht angemeldet ist (als Gast) und wie (in anderen Foren geht das mit
    Code :
    1
    
     
    hab ich hier auch probiert ging aber nicht)

    gruß
    Amarr
     

  4. #4
    badday badday ist offline Mitglied Brokat
    Registriert seit
    Dec 2009
    Beiträge
    321
    Blog-Einträge
    1
    Wenn es möglich ist, würde ich auf einen MS Compiler zurückgreifen, da ich nicht weiß, ob die Icmp-Sachen in den gcc Headern richtig implementiert sind ( http://www.cygwin.com/ml/cygwin/1997-10/msg00359.html ).

    Gruß,

    badday
     

  5. #5
    Amarr Amarr ist offline Rookie
    Registriert seit
    May 2010
    Beiträge
    7
    So hab mich mal angemeldet.

    @ badday: Danke werd ich mal Probieren.

    Hier nochmal der formatierte Code:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    
    #include <windows.h>
    #include <stdio.h>
    #include <winsock2.h>
    #include <io.h>
    #include <string.h>
    #include <iostream>
    #include <iphlpapi.h>
    #include <ipexport.h>
    #include "icmpapi.h"
     
    using namespace std;
     
    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
     
     
     
    void  IntToString(int i, char* buffer)
    {
        sprintf(buffer, "%d", i);
    }
     
    int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szComLine, int iCmdShow){
        char szName[] = "Fenster";
        char szTitel[] = "ScanU";
     
        int xPos = 0;
        int yPos = 0;
        int xSize = 600;
        int ySize = 400;
        HBRUSH bgColor = CreateSolidBrush(RGB(180,120,90));
        WNDCLASS wc;
     
        wc.style = CS_HREDRAW | CS_VREDRAW;
        wc.lpfnWndProc = WndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hI;
        wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);
        wc.hCursor = LoadCursor (NULL, IDC_ARROW);
        wc.hbrBackground = bgColor;
        wc.lpszMenuName = NULL;
        wc.lpszClassName = szName;
     
        RegisterClass (&wc);
     
        HWND hwnd = CreateWindow (szName, szTitel, WS_OVERLAPPEDWINDOW, xPos, yPos, xSize, ySize, NULL, NULL, hI, NULL);
        HWND BCX_Listbox(char*,HWND,int,int,int,int,int,int=0,int=-1);
        ShowWindow (hwnd, iCmdShow);
        UpdateWindow (hwnd);
     
        MSG msg;
        while(GetMessage (&msg, NULL, 0, 0)){
            TranslateMessage (&msg);
            DispatchMessage (&msg);
        }
        return msg.wParam;
    }
     
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
        HDC hdc;
        PAINTSTRUCT ps;
        static HWND hwndButton1, hwndButton2, sIP, eIP, sPort, ePort, list1, list2;
        char vIP[16], bIP[16];
        struct sockaddr_in addr;
        unsigned long start, end, temp;
     
        HANDLE IcmpFile;
        DWORD ReturnValue = 0;
        char SendData[] = "Ping";
        LPVOID ReplyBuffer = NULL;
        DWORD ReplySize = 0;
     
        switch (message){
            case WM_PAINT:
                hdc = BeginPaint (hwnd, &ps);
                    SetTextColor(hdc,RGB(0,0,0));
                    SetBkColor(hdc,RGB(180,120,90));
                    TextOut (hdc, 37, 10, "Start IP:", 9);
                    TextOut (hdc, 42, 30, "End IP:", 7);
                    TextOut (hdc, 400, 10, "Start Port:", 11);
                    TextOut (hdc, 405, 30, "End Port:", 9);
                EndPaint (hwnd, &ps);
                return (0);
            case WM_CREATE:
                hwndButton1 = CreateWindow ("button", "Netz Scannen", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 250, 50, 100, 20, hwnd, (HMENU)1,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
                hwndButton2 = CreateWindow ("button", "Ports Scannen", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 250, 180, 100, 20, hwnd, (HMENU)2,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
                sIP = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 92,10,110,18, hwnd, (HMENU)3, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
                eIP = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 92,30,110,18, hwnd, (HMENU)4, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
                sPort = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 470,10,50,18, hwnd, (HMENU)5, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
                ePort = CreateWindow("edit","",WS_CHILD | WS_VISIBLE, 470,30,50,18, hwnd, (HMENU)6, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
                list1 = CreateWindow ("listbox", "",WS_CHILD | WS_VISIBLE | LBS_STANDARD, 30, 75, 200, 250, hwnd, (HMENU)7,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE) , NULL);
                list2 = CreateWindow ("listbox", "",WS_CHILD | WS_VISIBLE | LBS_STANDARD, 370, 75, 200, 250, hwnd, (HMENU)8,(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE) , NULL);
                return (0);
            case WM_COMMAND:
                switch(LOWORD(wParam)){
                    case 1:
                        GetWindowText(sIP,vIP,16);
                        GetWindowText(eIP,bIP,16);
                        SendMessage(list1, LB_RESETCONTENT, 0, 0);
                        start = ntohl(inet_addr(vIP));
                        end = ntohl(inet_addr(bIP));
                        if (start > end){
                            temp = start;
                            start = end;
                            end = temp;
                        }
                        for(temp = start; temp <= end; temp++){
                            addr.sin_addr.s_addr = htonl(temp);
                            IcmpFile = IcmpCreateFile();
     
                            SendMessage(list1, LB_ADDSTRING, NULL, (LPARAM)inet_ntoa(addr.sin_addr));
                        }
                        break;
                    case 2:
                        break;
                }
                return(0);
            case WM_DESTROY:
                PostQuitMessage (0);
                return (0);
        }
        return DefWindowProc (hwnd, message, wParam, lParam);
    }
     

  6. #6
    deepthroat deepthroat ist offline Mitglied Diamant
    tutorials.de Premium-User
    Registriert seit
    Jun 2005
    Beiträge
    8.168
    Hi.
    Zitat Zitat von Amarr Beitrag anzeigen
    #include "icmpapi.h" // Da die icmpapi.h nicht dabei war habe ich sie von http://www.koders.com/c/fidB304BDC30...px?s=windows.h genommen.
    Wenn die Headerdatei nicht vorhanden ist, dann kannst du davon ausgehen, das die Funktionen die dort deklariert werden nicht in der entsprechenden MinGW Bibliothek vorhanden sind.

    Gruß

    PS: Man kann übrigens vom Programm nm auflisten lassen welche Symbole in einer Bibliothek definiert sind bzw. referenziert werden:
    Code :
    1
    2
    3
    
    nm libiphlpapi.a | findstr /i icmp
    00000000 T _GetIcmpStatistics@4
    00000000 I __imp__GetIcmpStatistics@4
    Eine IcmpCreateFile Funktion ist jedenfalls nicht enthalten.

    Aber es hindert einen ja keiner daran direkt die IpHlpApi.lib aus dem Plattform SDK zu verwenden...
    Geändert von deepthroat (19.05.10 um 19:12 Uhr)
     
    If at first you don't succeed, try again. Then quit. No use being a damn fool about it.

  7. #7
    Amarr Amarr ist offline Rookie
    Registriert seit
    May 2010
    Beiträge
    7
    Hi,
    Zitat Zitat von deepthroat Beitrag anzeigen
    Aber es hindert einen ja keiner daran direkt die IpHlpApi.lib aus dem Plattform SDK zu verwenden...
    dumme frage aber, wie mach ich das?
     

  8. #8
    deepthroat deepthroat ist offline Mitglied Diamant
    tutorials.de Premium-User
    Registriert seit
    Jun 2005
    Beiträge
    8.168
    Zitat Zitat von Amarr Beitrag anzeigen
    Hi,

    dumme frage aber, wie mach ich das?
    Du gibst einfach die IpHlpApi.lib aus dem Plattform SDK (welches du evlt. installieren müßtest) komplett mit Pfad beim Linken an.

    Gruß
     
    If at first you don't succeed, try again. Then quit. No use being a damn fool about it.

  9. #9
    Amarr Amarr ist offline Rookie
    Registriert seit
    May 2010
    Beiträge
    7
    Danke für die Hilfe deepthroat,
    aber nun ist ein anderer Fehler aufgetreten, nachdem ich die die lib aus dem SDK eingebunden hatte, hatte ich noch immer den selben fehler, dann habe ich die IcmpAPI.h ausm SDK auch über den Pfad eingebunden, dann war zumindest der erste Fehler weg, dafür sind jetzt eine ganze Reihe anderer Aufgetauch, ich tippe darauf, dass der Compiler das nicht "versteht".

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    
     
    **** Build of configuration Debug for project win ****
     
    **** Internal Builder is used for build               ****
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -owin.o ..\win.cpp
    In file included from ..\win.cpp:9:
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:118: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:119: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:172: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:173: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:174: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:175: error: `RequestSize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:175: error: `__in_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:176: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:177: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:178: error: `ReplySize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:178: error: `__out_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:179: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:180: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:181: error: initializer expression list treated as compound expression
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:254: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:255: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:256: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:260: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:262: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:263: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:264: error: `RequestSize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:264: error: `__in_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:265: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:266: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:267: error: `ReplySize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:267: error: `__out_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:268: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:269: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:270: error: initializer expression list treated as compound expression
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:275: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:276: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:277: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:281: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:283: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:284: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:285: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:286: error: `RequestSize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:286: error: `__in_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:287: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:288: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:289: error: `ReplySize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:289: error: `__out_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:290: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:291: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:292: error: initializer expression list treated as compound expression
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:298: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:299: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:300: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:304: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:306: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:307: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:308: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:309: error: `RequestSize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:309: error: `__in_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:310: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:311: error: `__in_opt' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:312: error: `ReplySize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:312: error: `__out_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:313: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:314: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:315: error: initializer expression list treated as compound expression
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:344: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:345: error: `ReplySize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:345: error: `__in_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:346: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:347: error: initializer expression list treated as compound expression
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:352: warning: `__stdcall__' attribute only applies to function types
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:353: error: `ReplySize' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:353: error: `__in_bcount' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:354: error: `__in' was not declared in this scope
    C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\IcmpAPI.H:355: error: initializer expression list treated as compound expression
    ..\win.cpp: In function `LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)':
    ..\win.cpp:111: warning: passing NULL used for non-pointer converting 3 of `LRESULT SendMessageA(HWND__*, UINT, WPARAM, LPARAM)'
    ..\win.cpp:68: warning: unused variable 'ReturnValue'
    ..\win.cpp:69: warning: unused variable 'SendData'
    ..\win.cpp:70: warning: unused variable 'ReplyBuffer'
    ..\win.cpp:71: warning: unused variable 'ReplySize'
    Build error occurred, build is stopped
    Time consumed: 3395  ms.

    Gibts da ne möglichkeit das verständlich zu machen, oder sollte ich lieber auf VC++ umsteigen? (will ich aber nicht unbedingt)
     

  10. #10
    deepthroat deepthroat ist offline Mitglied Diamant
    tutorials.de Premium-User
    Registriert seit
    Jun 2005
    Beiträge
    8.168
    Zitat Zitat von Amarr Beitrag anzeigen
    Danke für die Hilfe deepthroat,
    aber nun ist ein anderer Fehler aufgetreten, nachdem ich die die lib aus dem SDK eingebunden hatte, hatte ich noch immer den selben fehler, dann habe ich die IcmpAPI.h ausm SDK auch über den Pfad eingebunden, dann war zumindest der erste Fehler weg, dafür sind jetzt eine ganze Reihe anderer Aufgetauch, ich tippe darauf, dass der Compiler das nicht "versteht".
    Die Header aus dem SDK kannst du nur mit dem Microsoft Compiler verwenden.

    Gruß
     
    If at first you don't succeed, try again. Then quit. No use being a damn fool about it.

  11. #11
    Amarr Amarr ist offline Rookie
    Registriert seit
    May 2010
    Beiträge
    7
    Ok danke werd ich mir wohl mal einen besorgen müssen.

    Gibts villeicht auch eine Möglichkeit das ohne nen MS Compiler zu realisieren? Die lib ist jetzt ja die ausm SDK, die Fehlermeldung ist jedoch geblieben. Kann man das irgendwie zum laufen bekommen oder ehr nicht?
     

  12. #12
    deepthroat deepthroat ist offline Mitglied Diamant
    tutorials.de Premium-User
    Registriert seit
    Jun 2005
    Beiträge
    8.168
    Zitat Zitat von Amarr Beitrag anzeigen
    Ok danke werd ich mir wohl mal einen besorgen müssen.

    Gibts villeicht auch eine Möglichkeit das ohne nen MS Compiler zu realisieren? Die lib ist jetzt ja die ausm SDK, die Fehlermeldung ist jedoch geblieben. Kann man das irgendwie zum laufen bekommen oder ehr nicht?
    Welche Fehlermeldung? \edit: Du hast doch die libiphlpapi.lib Datei wieder aus den zu linkenden Bibliotheken entfernt, oder?

    Gruß
     
    If at first you don't succeed, try again. Then quit. No use being a damn fool about it.

  13. #13
    Amarr Amarr ist offline Rookie
    Registriert seit
    May 2010
    Beiträge
    7
    Zitat Zitat von deepthroat Beitrag anzeigen
    Welche Fehlermeldung? \edit: Du hast doch die libiphlpapi.lib Datei wieder aus den zu linkenden Bibliotheken entfernt, oder?

    Gruß
    Wenn ich nur die IPHlpApi.Lib ausm SDK einbinde (die von MinGW habe ich nicht mehr gelinkt) und die icmpapi.h nehme dich ich ausm Netz geholt habe (Link siehe erster beitrag) bleibt die Fehlermeldung die selbe:
    Code :
    1
    
    workspace/win/Debug/../win.cpp:109: undefined reference to `IcmpCreateFile@0'

    Gruß
     

  14. #14
    deepthroat deepthroat ist offline Mitglied Diamant
    tutorials.de Premium-User
    Registriert seit
    Jun 2005
    Beiträge
    8.168
    Zitat Zitat von Amarr Beitrag anzeigen
    Wenn ich nur die IPHlpApi.Lib ausm SDK einbinde (die von MinGW habe ich nicht mehr gelinkt) und die icmpapi.h nehme dich ich ausm Netz geholt habe (Link siehe erster beitrag) bleibt die Fehlermeldung die selbe:
    Code :
    1
    
    workspace/win/Debug/../win.cpp:109: undefined reference to `IcmpCreateFile@0'
    Das kann ich nicht nachvollziehen. Evtl. hast du das irgendwie falsch eingetragen? Wie sieht denn der Befehl aus der ausgeführt wird?

    Mit
    Code :
    1
    
    gcc   -mwindows  -o icmptest icmptest.o  -lws2_32 c:/Programme/Microsoft\ SDKs/Windows/v7.0/Lib/IPHlpApi.Lib
    Kann es bei mir erfolgreich gelinkt werden.

    Gruß
     
    If at first you don't succeed, try again. Then quit. No use being a damn fool about it.

  15. #15
    Amarr Amarr ist offline Rookie
    Registriert seit
    May 2010
    Beiträge
    7
    So sieht die Meldung komplett aus:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    **** Build of configuration Debug for project win ****
     
    **** Internal Builder is used for build               ****
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -owin.o ..\win.cpp
    ..\win.cpp: In function `LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)':
    ..\win.cpp:110: warning: passing NULL used for non-pointer converting 3 of `LRESULT SendMessageA(HWND__*, UINT, WPARAM, LPARAM)'
    g++ -LC:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\IPHlpApi.Lib -mwindows -owin.exe win.o -lws2_32
    win.o: In function `Z7WndProcP6HWND__jjl':
    C:/Users/Dominik/workspace/win/Debug/../win.cpp:109: undefined reference to `IcmpCreateFile()@0'
    collect2: ld returned 1 exit status
    Build error occurred, build is stopped
    Time consumed: 5103  ms.

    Hier ist nochma ein screen von den gelinkten Librarys
    http://www.bilder-hochladen.net/files/5j8l-1-jpg.html
    vielleicht hilft der dir weiter

    die IPHlpApi.lib musste ich als -L eintragen, da er sagt, das er die Datei bzw das Verzeichnis nicht findet wenn ich es als -l (also oben) eintrage.

    gruß
     

Ähnliche Themen

  1. Antworten: 0
    Letzter Beitrag: 11.01.11, 21:40
  2. Antworten: 4
    Letzter Beitrag: 22.03.06, 20:50
  3. Antworten: 0
    Letzter Beitrag: 06.10.04, 14:03
  4. PROBLEM! Pinnacle 2 GB Begrenzung Windows 2000 DC 50 PROBLEM!
    Von hennym im Forum Videoschnitt, Videotechnik & -produktion
    Antworten: 6
    Letzter Beitrag: 17.09.03, 22:09
  5. Antworten: 6
    Letzter Beitrag: 13.06.02, 12:29