[BCB]ㄧ個奇怪的compiler錯誤訊息>__< |
尚未結案
|
dbstudio
一般會員 發表:13 回覆:18 積分:6 註冊:2003-12-07 發送簡訊給我 |
最近使用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 發送簡訊給我 |
對不起我再說詳細一點:
我寫了一個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 發送簡訊給我 |
|
dbstudio
一般會員 發表:13 回覆:18 積分:6 註冊:2003-12-07 發送簡訊給我 |
|
mkbobo
一般會員 發表:4 回覆:68 積分:19 註冊:2003-04-10 發送簡訊給我 |
|
dbstudio
一般會員 發表:13 回覆:18 積分:6 註冊:2003-12-07 發送簡訊給我 |
|
dbstudio
一般會員 發表:13 回覆:18 積分:6 註冊:2003-12-07 發送簡訊給我 |
您好,我已經重寫過這個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
------
哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有 |
mkbobo
一般會員 發表:4 回覆:68 積分:19 註冊:2003-04-10 發送簡訊給我 |
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 發送簡訊給我 |
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
dbstudio您好:
我測試沒有問題耶,我放在
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=46030 您再試看看囉 <>~我也是在學習的階段,回答的不好請您多多見諒與指教~>
|
dbstudio
一般會員 發表:13 回覆:18 積分:6 註冊:2003-12-07 發送簡訊給我 |
引言: 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 發送簡訊給我 |
|
dbstudio
一般會員 發表:13 回覆:18 積分:6 註冊:2003-12-07 發送簡訊給我 |
引言:祝順心 哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有引言: #pragma hdrstop 沒有加入這行的話, 那個Warning就會跑出來, 請問一下,#pragma hdrstop這是什麼敘述呢? 我知道這是一些Compile前置的語句, 但是用途是什麼呀?請參考 http://edu.uuu.com.tw/article/010307a.htm 在問~~你有使用收尋網站找過你的問題嗎? 如果我知道問題是什麼的話...:( 我就找到了啊... 其實這個問題困擾我已經ㄧ陣子了, 問了人人家也不知道....呼呼~~~ BBS上面一堆人都被我煩透了~~ 總之,謝謝你跟另外版主大人
------
哇錦喊嫚公為 膽喜挖金喜災 蓋小哩厚有 |
mkbobo
一般會員 發表:4 回覆:68 積分:19 註冊:2003-04-10 發送簡訊給我 |
引言:引言: -------------------------------------------------------------------------------- 引言: -------------------------------------------------------------------------------- #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 也可以利用此網站的搜尋 找出你想要的答案 如果沒有~哪就用力的問吧~~ 加油~~~^_^ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |