Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - writing c code in a c++ app
Hello, I am having difficulties in writing a c++ prog that uses C code to send an icmp packet (icmpapi.h, ipexport.h (used by icmpapi.h)). This is what my code looks like so far: ------------------------------------- #include <iostream> #include <windows.h> extern "C" { #include <icmpapi.h> } int main(){ using namespace std; HANDLE icmp; icmp = IcmpCreateFile(); cout << "hello"; return 0; } ________________________________________________ It compiles but then i get an error that says: _______________________________________________ hello.obj(hello) Error 42: Symbol Undefined _IcmpCreateFile 0 --- errorlevel 1 _______________________________________________ Before i added the: extern "C" I would get the error: _____________________________________________________________________ hello.obj(hello) Error 42: Symbol Undefined ?IcmpCreateFile YGPAXXZ (void *stdcall IcmpCreateFile (void )) --- errorlevel 1 _____________________________________________________________________ Any insight would be greatly appreciated. Is there a way to send a custom icmp packet using C++ libraries? This might help some. The code for sending the exact packet I need to send is already written in C for me, so ideally I would like to write a C++ prog that does some extra work but also sends the icmp packet (exactly as written in the already existing C code that I have). Thank you, David S Feb 10 2005
You've got to include the library in the link that contains IcmpCreateFile (). Jan david wrote:Hello, I am having difficulties in writing a c++ prog that uses C code to send an icmp packet (icmpapi.h, ipexport.h (used by icmpapi.h)). This is what my code looks like so far: ------------------------------------- #include <iostream> #include <windows.h> extern "C" { #include <icmpapi.h> } int main(){ using namespace std; HANDLE icmp; icmp = IcmpCreateFile(); cout << "hello"; return 0; } ________________________________________________ It compiles but then i get an error that says: _______________________________________________ hello.obj(hello) Error 42: Symbol Undefined _IcmpCreateFile 0 --- errorlevel 1 _______________________________________________ Before i added the: extern "C" I would get the error: _____________________________________________________________________ hello.obj(hello) Error 42: Symbol Undefined ?IcmpCreateFile YGPAXXZ (void *stdcall IcmpCreateFile (void )) --- errorlevel 1 _____________________________________________________________________ Any insight would be greatly appreciated. Is there a way to send a custom icmp packet using C++ libraries? This might help some. The code for sending the exact packet I need to send is already written in C for me, so ideally I would like to write a C++ prog that does some extra work but also sends the icmp packet (exactly as written in the already existing C code that I have). Thank you, David S Feb 10 2005
The file that contains IcmpCreateFile () is icmpapi.h and i've included that file in my prog. Is this what you mean by including the library in the link that contains IcmpCreateFile ()? In article <cugg6l$2tn3$1 digitaldaemon.com>, Jan Knepper says...You've got to include the library in the link that contains IcmpCreateFile (). Jan david wrote:Hello, I am having difficulties in writing a c++ prog that uses C code to send an icmp packet (icmpapi.h, ipexport.h (used by icmpapi.h)). This is what my code looks like so far: ------------------------------------- #include <iostream> #include <windows.h> extern "C" { #include <icmpapi.h> } int main(){ using namespace std; HANDLE icmp; icmp = IcmpCreateFile(); cout << "hello"; return 0; } ________________________________________________ It compiles but then i get an error that says: _______________________________________________ hello.obj(hello) Error 42: Symbol Undefined _IcmpCreateFile 0 --- errorlevel 1 _______________________________________________ Before i added the: extern "C" I would get the error: _____________________________________________________________________ hello.obj(hello) Error 42: Symbol Undefined ?IcmpCreateFile YGPAXXZ (void *stdcall IcmpCreateFile (void )) --- errorlevel 1 _____________________________________________________________________ Any insight would be greatly appreciated. Is there a way to send a custom icmp packet using C++ libraries? This might help some. The code for sending the exact packet I need to send is already written in C for me, so ideally I would like to write a C++ prog that does some extra work but also sends the icmp packet (exactly as written in the already existing C code that I have). Thank you, David S Feb 10 2005
"david" <david_member pathlink.com> wrote in message news:cugnfk$3ul$1 digitaldaemon.com...The file that contains IcmpCreateFile () is icmpapi.h and i've included Feb 10 2005
|