線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1056
推到 Plurk!
推到 Facebook!

[BCB]ㄧ個奇怪的compiler錯誤訊息>__<

尚未結案
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-02-25 23:11:12 IP:61.221.xxx.xxx 未訂閱
最近使用BCB寫程式時,突然跑出一堆以前沒看過的錯誤訊息>___< 請好心人士救命~~~是不是我的BCB出問題了~~~~~ 1.Canont creat Pre-Compiled header : code in header. 這個是我匯入自己寫的head file時... 2.Internal Compiler error: xxxsegment 0x4089 xxxxx..... ↑這個沒遇過>___<完全不知道是什麼...compile內部錯誤?! 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-02-26 10:09:40 IP:61.221.xxx.xxx 未訂閱
對不起我再說詳細一點: 我寫了一個Matrix.h 裡面定義了矩陣的一些性質, 然後我寫了一個Matrix.cpp 去實作Matrix 類別的member function, 接著我再依各Unit.cpp中,使用了 #include "Matrix.cpp" 結果就有了preComipler error:Code in header 我查了一下說明,他說: One of the headers contained a non-inline function body 這到底是什麼意思呢? 我的類別的初始宣告如下:
typedef float Cell;    class Matrix
 {
  private:
   int ROW;
   int COL;
   Cell *cell;      protected:
   void Swap(Cell *a, Cell *b);      public:
   //Ctor and Dtor.
   Matrix(int Col, int Row);
   ~Matrix();       //Matrix festures.
   inline int loc(int Col, int Row) {return ((Row-1)*COL   Col - 1);};
   inline Cell getCell(int Col, int Row) {return cell[loc(Col,Row)];};
   inline void setCell(Cell cell, int Col, int Row)
                {this->cell[loc(Col,Row)] = cell;};       //initial Matrix element.
   void iniIdentity();
   void iniMatrix(Cell *array, int length);       //elementary operation.
   void Interchange(int Row1, int Row2);
   void MulRow(float factor, int Row);
   void AddMultiple(float factor, int Row1, int Row2);
 }; 
謝謝好心人的回答 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
mkbobo
一般會員


發表:4
回覆:68
積分:19
註冊:2003-04-10

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-02-27 09:57:24 IP:61.222.xxx.xxx 未訂閱
#include "Matrix.cpp"
 
不好意思 請問一下你為何是 include Matrix.cpp 而不是 Matrix.h呢????
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-02-27 19:18:08 IP:61.221.xxx.xxx 未訂閱
引言:
#include "Matrix.cpp"
 
不好意思 請問一下你為何是 include Matrix.cpp 而不是 Matrix.h呢????
我的設計是, class Matrix的各種成員函數,跟資訊都在Matrix.h中, 阿,member function的實作,放在Matrix.cpp中,Matrix.cpp 匯入 Matrix.h, 這樣...是不是不對啊? 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
mkbobo
一般會員


發表:4
回覆:68
積分:19
註冊:2003-04-10

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-03-01 09:23:43 IP:61.222.xxx.xxx 未訂閱
引言: 我的設計是, class Matrix的各種成員函數,跟資訊都在Matrix.h中, 阿,member function的實作,放在Matrix.cpp中,Matrix.cpp 匯入 Matrix.h,
聽起來是沒錯的 但是我的問題是 你為何要在Unit1.cpp 去
#include "Matrix.cpp" 
呢?
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-03-01 21:56:49 IP:61.221.xxx.xxx 未訂閱
引言:
引言: 我的設計是, class Matrix的各種成員函數,跟資訊都在Matrix.h中, 阿,member function的實作,放在Matrix.cpp中,Matrix.cpp 匯入 Matrix.h,
聽起來是沒錯的 但是我的問題是 你為何要在Unit1.cpp 去
#include "Matrix.cpp" 
呢?
糟糕...可是我匯入 > 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-03-04 16:43:20 IP:61.221.xxx.xxx 未訂閱
您好,我已經重寫過這個head file,以下是程式碼, 可是當我匯入時,BCB還是告訴我:Cannot compile head file: code in header. 雖然是一個Warning,不過當我要使用我這個head file中的物件時,就必定會掛掉 可以敎我ㄧ下,我哪裡有寫錯嗎? 以下是程式碼: < class="code"> class Matrix { private: int Col; int Row; double *cell; protected: inline void Swap(double *a, double *b) {double temp; temp = *a; *a = *b; *b = temp;} public: //Ctor and Dtor inline Matrix(int col, int row) {Col = col; Row = row; cell = new double[Col * Row];} inline ~Matrix() {delete[] cell;} //member function. inline int loc(int col, int row) {return ((row-1)*Col col) -1;} void iniMatrix(); // initial to identity Matrix. void iniMatrix(double array[], int length); //initial with array. inline void setCell(double value, int col, int row) {cell[loc(col,row) = value;]}; inline double getCell(int col, int row) {return cell[loc(col,row)];} //elementary operation. void intersection(int row1, int row2); void mul(double factor, int row); void mul_add(double factor, int row1, int row2); //Matrix Operation. Matrix operator (Matrix add); Matrix operator*(Matrix mul); }; //set to identity matirx. void Matrix::iniMatrix() { for(int row=1 ; row<=Row; row ) for(int col=1; col<=Col; col ) { if(row == col) { cell[loc(col,row)] = 1; }else { cell[loc(col,row)] = 0; } } } //set Matrix by an input array. void Matrix::iniMatrix(double array[], int length) { for(int i= 0; i 我把他放在Matrix.h中,然後用Console Wizard開啟一個Unit1.cpp, 匯入這個檔案就是不行,ㄧ定會有Warning,快要瘋掉了 希望好心人士救救我~~~ 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
mkbobo
一般會員


發表:4
回覆:68
積分:19
註冊:2003-04-10

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-03-05 09:41:19 IP:61.222.xxx.xxx 未訂閱
 class Matrix
 {
  private:
   int Col;
   int Row;
   double *cell;      protected:
   inline void Swap(double *a, double *b) {double temp; temp = *a; *a = *b; *b = temp;}      public:
   //Ctor and Dtor
   inline Matrix(int col, int row) {Col = col; Row = row; cell = new double[Col * Row];}
   inline ~Matrix() {delete[] cell;}       //member function.
   inline int loc(int col, int row) {return ((row-1)*Col   col) -1;}
   void iniMatrix(); // initial to identity Matrix.
   void iniMatrix(double array[], int length); //initial with array.
   inline void setCell(double value, int col, int row) {cell[loc(col,row) = value;]};
   inline double getCell(int col, int row) {return cell[loc(col,row)];}
   
   //elementary operation.
   void intersection(int row1, int row2);
   void mul(double factor, int row);
   void mul_add(double factor, int row1, int row2);       //Matrix Operation.
   Matrix operator (Matrix add);
   Matrix operator*(Matrix mul);
 };    
你的程式 這裡很奇怪 紅色的部分 loc(col,row) = value; 不曉得是我才疏學淺還是... 可否請你解釋一下 為何要把
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#9 引用回覆 回覆 發表時間:2004-03-05 19:55:22 IP:61.221.xxx.xxx 未訂閱
對不起對不起,我copy paste的時候好像不小心改到>__< 那各陣列的是cell[loc(,)] = value 啦~~~真是的,我糊塗忘記再chk一遍:p    可是,你include真的都沒有問題喔... 那...到底是發生什麼事情...靈異現象? 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
taishyang
站務副站長


發表:377
回覆:5490
積分:4563
註冊:2002-10-08

發送簡訊給我
#10 引用回覆 回覆 發表時間:2004-03-05 23:41:32 IP:140.135.xxx.xxx 未訂閱
dbstudio您好: 我測試沒有問題耶,我放在 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=46030 您再試看看囉 <>~我也是在學習的階段,回答的不好請您多多見諒與指教~
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#11 引用回覆 回覆 發表時間:2004-03-06 21:35:39 IP:61.222.xxx.xxx 未訂閱
引言: dbstudio您好: 我測試沒有問題耶,我放在 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=46030 您再試看看囉 <>~我也是在學習的階段,回答的不好請您多多見諒與指教~ < face="Verdana, Arial, Helvetica"> 謝謝您:) 首先,我剛剛試了一下, #pragma hdrstop 沒有加入這行的話, 那個Warning就會跑出來, 請問一下,#pragma hdrstop這是什麼敘述呢? 我知道這是一些Compile前置的語句, 但是用途是什麼呀? 再次謝謝您~~~~ 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
mkbobo
一般會員


發表:4
回覆:68
積分:19
註冊:2003-04-10

發送簡訊給我
#12 引用回覆 回覆 發表時間:2004-03-08 10:32:19 IP:61.222.xxx.xxx 未訂閱
引言: #pragma hdrstop 沒有加入這行的話, 那個Warning就會跑出來, 請問一下,#pragma hdrstop這是什麼敘述呢? 我知道這是一些Compile前置的語句, 但是用途是什麼呀?
請參考 http://edu.uuu.com.tw/article/010307a.htm 在問~~你有使用收尋網站找過你的問題嗎?
dbstudio
一般會員


發表:13
回覆:18
積分:6
註冊:2003-12-07

發送簡訊給我
#13 引用回覆 回覆 發表時間:2004-03-08 21:12:14 IP:61.221.xxx.xxx 未訂閱
引言:
引言: #pragma hdrstop 沒有加入這行的話, 那個Warning就會跑出來, 請問一下,#pragma hdrstop這是什麼敘述呢? 我知道這是一些Compile前置的語句, 但是用途是什麼呀?
請參考 http://edu.uuu.com.tw/article/010307a.htm 在問~~你有使用收尋網站找過你的問題嗎? 如果我知道問題是什麼的話...:( 我就找到了啊... 其實這個問題困擾我已經ㄧ陣子了, 問了人人家也不知道....呼呼~~~ BBS上面一堆人都被我煩透了~~ 總之,謝謝你跟另外版主大人
祝順心 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有
------
哇錦喊嫚公為
膽喜挖金喜災
蓋小哩厚有
mkbobo
一般會員


發表:4
回覆:68
積分:19
註冊:2003-04-10

發送簡訊給我
#14 引用回覆 回覆 發表時間:2004-03-09 09:36:40 IP:61.222.xxx.xxx 未訂閱
引言:引言: -------------------------------------------------------------------------------- 引言: -------------------------------------------------------------------------------- #pragma hdrstop 沒有加入這行的話, 那個Warning就會跑出來, 請問一下,#pragma hdrstop這是什麼敘述呢? 我知道這是一些Compile前置的語句, 但是用途是什麼呀? -------------------------------------------------------------------------------- 請參考 http://edu.uuu.com.tw/article/010307a.htm 在問~~你有使用收尋網站找過你的問題嗎? 如果我知道問題是什麼的話...:( 我就找到了啊... 其實這個問題困擾我已經ㄧ陣子了, 問了人人家也不知道....呼呼~~~ BBS上面一堆人都被我煩透了~~ 總之,謝謝你跟另外版主大人
不好意思 其實我會問你這個問題 是我將你所提問的 #pragma hdrstop 直接打在 google 上 http://www.google.com.tw/search?hl=zh-TW&ie=UTF-8&oe=UTF-8&q=%23pragma+hdrstop&btnG=Google+%E6%90%9C%E5%B0%8B&lr=lang_zh-TW 它的第一個網址就是答案了 所以有點懷疑~~^^" 不說廢話了~~我想跟你說的是~~你可以善加利用 搜尋的網站 例如 GOOGLE 也可以利用此網站的搜尋 找出你想要的答案 如果沒有~哪就用力的問吧~~ 加油~~~^_^
系統時間:2024-05-18 14:31:21
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!