[問題] 變數宣告的位置
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Qt 4.8.1 for desktop - MSVC2010 (Qt SDK)
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
QtSql
math
OsiClpSolverInterface (open source, 解線性規劃的solver)
問題(Question):
line 137 的指標變數 如果new在line 113 的function前面 程式執行後會當掉
跳出exe has stopped working. windows will close the program balabala...
用debug模式 過了line 137這個變數後 會出現
the inferior stopped because it triggered an exception
stopped in thread 0 by : exception at 0x6dddcb4c, code:0xc0000005:
read access violation at: 0x0, flag = 0x0
但若將line 137的變數 new 在line 113的function之後, 也就是將line 108放到
opt.SolveNetwork() 之後,程式就可順利的執行完成~@@!
若一定要在呼叫那個function後才能new 就會變成迴圈
每跑一次都要new一次,但我只需要先new一次 把迴圈每圈的結果收集起來
找了兩天還是不知道為何會這樣...請問這是啥原因~感謝
程式碼(Code):(請善用置底文網頁, 記得排版)
http://codepad.org/4EV9ESmT
SolveNetwork的程式碼 http://codepad.org/vkKPo49v
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 161.130.178.168
→
01/15 18:51, , 1F
01/15 18:51, 1F
→
01/15 19:26, , 2F
01/15 19:26, 2F
→
01/15 19:28, , 3F
01/15 19:28, 3F
→
01/15 19:29, , 4F
01/15 19:29, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章