標籤:des style c code tar a
在Qualnet裡添加了一個應用程式層協議,編譯完全通過,但在運行時總是在63s記憶體讀取錯誤。可以肯定是路由表更新處指標調用錯誤了.為了定位錯誤,最可靠的辦法就是使用VS進行調試。但按照官方手冊設定調試時,卻出現了如下錯誤資訊:‘qualnet.exe‘: Loaded ‘C:\snt\qualnet\5.0\bin\qualnet.exe‘, Symbols loaded.‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\ntdll.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\kernel32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\ws2_32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\advapi32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\rpcrt4.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\secur32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\msvcrt.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\ws2help.dll‘‘qualnet.exe‘: Loaded ‘C:\snt\qualnet\5.0\bin\libexpat.dll‘, Binary was not built with debug information.‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\user32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\gdi32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\netapi32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\comdlg32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\comctl32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\shell32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\shlwapi.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\imm32.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\lpk.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\system32\usp10.dll‘‘qualnet.exe‘: Loaded ‘C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\comctl32.dll‘The program ‘[6780] qualnet.exe: Native‘ has exited with code 10 (0xa).
問題分析與解決:(1)“Binary was not built with debug information.”為編譯是沒加上調試選項。這和後面斷點調試出現的“The breakpoint will not currently be hit. No symbols have been loaded for this document”的原因一樣。這是因為選擇VS編譯器中的編譯按鈕,調用的是QUALNET_HOME\Makefile編譯檔案,根據官方手冊指導,Makefile調用的是QUALNET_HOME\main\Makefile-windows-vc9,而手冊只是說要在QUALNET_HOME\main\Makefile裡開啟DEBUG = /Zi調試選項,並沒有說明要在QUALNET_HOME\main\Makefile-windows-vc9裡開啟,因此按照手冊操作發生此錯誤。解決辦法兩種:1)按照手冊,在QUALNET_HOME\main\Makefile裡開啟DEBUG = /Zi調試選項,然後開啟QualNet Developer xxx Command-Line,進入QUALNET_HOME\main目錄,在裡面用命令nmake clean/nmake進行編譯。2)修改QUALNET_HOME\Makefile編譯檔案,使其調用指向為QUALNET_HOME\main\Makefile,然後在QUALNET_HOME\main\Makefile裡開啟DEBUG = /Zi調試選項。使用VS編譯器中的編譯按鈕進行編譯。
(2)“The program ‘[6780] qualnet.exe: Native‘ has exited with code 10 (0xa).”為調試時沒有指定情境設定檔,解決辦法可如下:1) Start Visual C++ 2008.2) Select File > Open > Project/Solutionand select the qualnet project.(而不是手冊說的qualnet.exe)3) Select Project > Properties > Configuration Properties > Debugging. Set Command Argumentsto the name of the scenario configuration (.config) file to be debugged. Set Working Directoryto the directory where the scenario configuration file is located4) Set the breakpoints as desired and debug using the commands listed in the Debugmenu.5) start Debug