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 have to link it together with the import library of icmp.dll. You can make the import library yourself. Start command prompt and type this: implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or C:\WINDOWS\system32\icmp.dll for winxp) Just link it together when you compile your source: dmc hello.cpp icmp.lib or if you just compile the source only (with the -c option) and you would like to link it yourself: link hello.obj icmp.lib In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...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 11 2005
When i attempt: dmc hello.cpp icmp.lib it says: Error 43: Not a Valid Library File The file is in the 'lib' directory and it does indicate that its attempting to link the .lib file. Do I just have a bad .lib file? What about the icmp.dll file? Does the .lib file use the .dll file in the system32 folder? I have one in my system32 right now, so I am assuming I am ok there. Thank you, David In article <cuif84$235e$1 digitaldaemon.com>, Jack says...You have to link it together with the import library of icmp.dll. You can make the import library yourself. Start command prompt and type this: implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or C:\WINDOWS\system32\icmp.dll for winxp) Just link it together when you compile your source: dmc hello.cpp icmp.lib or if you just compile the source only (with the -c option) and you would like to link it yourself: link hello.obj icmp.lib In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...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 16 2005
use the one I attached on this message (icmp.zip) In article <cv1fro$2aht$1 digitaldaemon.com>, david says...When i attempt: dmc hello.cpp icmp.lib it says: Error 43: Not a Valid Library File The file is in the 'lib' directory and it does indicate that its attempting to link the .lib file. Do I just have a bad .lib file? What about the icmp.dll file? Does the .lib file use the .dll file in the system32 folder? I have one in my system32 right now, so I am assuming I am ok there. Thank you, David In article <cuif84$235e$1 digitaldaemon.com>, Jack says...You have to link it together with the import library of icmp.dll. You can make the import library yourself. Start command prompt and type this: implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or C:\WINDOWS\system32\icmp.dll for winxp) Just link it together when you compile your source: dmc hello.cpp icmp.lib or if you just compile the source only (with the -c option) and you would like to link it yourself: link hello.obj icmp.lib In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...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 17 2005
Jack, When I click on the link, the browser just hangs. Could you please send the file to david.b.salgado gmail.com. Thank you, David In article <cv1mts$2ir0$1 digitaldaemon.com>, Jack says...use the one I attached on this message (icmp.zip) In article <cv1fro$2aht$1 digitaldaemon.com>, david says...When i attempt: dmc hello.cpp icmp.lib it says: Error 43: Not a Valid Library File The file is in the 'lib' directory and it does indicate that its attempting to link the .lib file. Do I just have a bad .lib file? What about the icmp.dll file? Does the .lib file use the .dll file in the system32 folder? I have one in my system32 right now, so I am assuming I am ok there. Thank you, David In article <cuif84$235e$1 digitaldaemon.com>, Jack says...You have to link it together with the import library of icmp.dll. You can make the import library yourself. Start command prompt and type this: implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or C:\WINDOWS\system32\icmp.dll for winxp) Just link it together when you compile your source: dmc hello.cpp icmp.lib or if you just compile the source only (with the -c option) and you would like to link it yourself: link hello.obj icmp.lib In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...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 18 2005
I keep receiving the message "delivery failure" while trying to send the file to your email. So I just upload the file at here: http://www.freewebs.com/jackliew/icmp.zip In article <cv4bac$2981$1 digitaldaemon.com>, david says...Jack, When I click on the link, the browser just hangs. Could you please send the file to david.b.salgado gmail.com. Thank you, David In article <cv1mts$2ir0$1 digitaldaemon.com>, Jack says...use the one I attached on this message (icmp.zip) In article <cv1fro$2aht$1 digitaldaemon.com>, david says...When i attempt: dmc hello.cpp icmp.lib it says: Error 43: Not a Valid Library File The file is in the 'lib' directory and it does indicate that its attempting to link the .lib file. Do I just have a bad .lib file? What about the icmp.dll file? Does the .lib file use the .dll file in the system32 folder? I have one in my system32 right now, so I am assuming I am ok there. Thank you, David In article <cuif84$235e$1 digitaldaemon.com>, Jack says...You have to link it together with the import library of icmp.dll. You can make the import library yourself. Start command prompt and type this: implib c:\apps\dm\lib\icmp.lib C:\WINNT\system32\icmp.dll (or C:\WINDOWS\system32\icmp.dll for winxp) Just link it together when you compile your source: dmc hello.cpp icmp.lib or if you just compile the source only (with the -c option) and you would like to link it yourself: link hello.obj icmp.lib In article <cugbdi$2ohp$1 digitaldaemon.com>, david says...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 19 2005
|