📄 subject_47184.htm
字号:
<p>
序号:47184 发表者:ophir 发表日期:2003-07-18 10:32:57
<br>主题:致命错误!谁能帮帮我!!!
<br>内容:Linking...<BR>ImageProc.obj : error LNK2001: unresolved external symbol "int __cdecl _iIntCmpFunc(void const *,void const *)" (?_iIntCmpFunc@@YAHPBX0@Z)<BR><BR>Debug/Test.exe : fatal error LNK1120: 1 unresolved externals<BR>Error executing link.exe.<BR><BR>Test.exe - 2 error(s), 0 warning(s)<BR><BR>编译已经通过了,链接时就这样了,怎么办呢?各位好心的高手帮帮我!!<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:松鼠 回复日期:2003-07-18 10:37:30
<br>内容:你的程序里定义了iIntCmpFunc()函数,但是没有函数的具体内容,(没有函数体)就会得到这个结果。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ophir 回复日期:2003-07-18 12:18:36
<br>内容:松鼠,让我再次感谢您的帮助.请允许我再提几个问题:<BR>1.你是怎样在没看到程序的情况下就一下子指出问题的所在?要做到您这点应该学习哪方面的知识?<BR>2.下面是原码,请您看一下:<BR><BR><BR>// vImageAreaProcess : 中值滤波函数<BR>// 参数说明 :<BR>//<BR>// hpSrcImage ---- 原图像数据区指针 , 数据量应为 Width * Height.<BR>// 即 g = f( x , y) 的离散数字图像 .<BR>// hpDestImge ---- 目标图像数据区指针 , 数据量应为 :<BR>// ( right - left + 1 ) * ( bottom - top + 1 )个.<BR>// Width , Height ---- 指出数字图像的宽和高.<BR>// left , top , right , bottom --- 处理区域坐标范围.<BR>//<BR>// NeighberhoodColumns , NeighberhoodRows ---- 指出邻域大小.<BR>//<BR>// 基本操作 : 此函数对图像或图像的部分区域进行中值滤波.<BR><BR>void ImageProc::vMiddleFilter( unsigned char HUGEPTR *hpSrcImage ,<BR> unsigned char HUGEPTR *hpDestImage,<BR> unsigned int Width , unsigned int Height,<BR> unsigned int left , unsigned int top ,<BR> unsigned int right , unsigned int bottom ,<BR> unsigned int NeighberhoodColumns ,<BR> unsigned int NeighberhoodRows<BR> )<BR>{<BR> //有问题函数!<BR> int _iIntCmpFunc( const void * i1 , const void * i2 );<BR><BR> register unsigned long i , j ;<BR> int * ipBlock = new int [ NeighberhoodColumns * NeighberhoodRows + 10 ] ;<BR><BR> long iDestWidth = right - left + 1 ;<BR>// long iDestHeight = bottom - top + 1 ;<BR><BR>// 对目标图像数据区清零 .<BR>// for ( i = 0 ; i < iDestWidth ; i ++ )<BR>// for ( j = 0 ; j < iDestHeight ; j ++ )<BR>// * ( hpDestImage + i * iDestWidth + j ) = 0 ;<BR><BR> int iAdjLeft , iAdjTop , iAdjRight , iAdjBottom ;<BR><BR> const unsigned int iHalfWidth = NeighberhoodColumns / 2 ;<BR> const unsigned int iHalfHeight = NeighberhoodRows / 2 ;<BR><BR> // 左边缘校正<BR> if ( left < iHalfWidth )<BR> iAdjLeft = iHalfWidth ;<BR> else<BR> iAdjLeft = left ;<BR> // 上边缘校正<BR> if ( top < iHalfHeight )<BR> iAdjTop = iHalfHeight ;<BR> else<BR> iAdjTop = top ;<BR> // 右边缘校正<BR> if ( right > ( Width - 1 ) - iHalfWidth )<BR> iAdjRight = ( Width - 1 ) - iHalfWidth ;<BR> else<BR> iAdjRight = right ;<BR> // 下边缘校正<BR> if ( bottom > ( Height - 1 ) - iHalfHeight )<BR> iAdjBottom = ( Height - 1 ) - iHalfHeight ;<BR> else<BR> iAdjBottom = bottom ;<BR><BR> register long Col , Row ;<BR> int iTempRow , iTempCol ;<BR>// int iChenged ;<BR><BR> // 求卷积和:<BR> for ( Row = iAdjTop ; Row <= iAdjBottom ; Row ++ )<BR> {<BR> iTempRow = Row - iHalfHeight ;<BR> for ( Col = iAdjLeft ; Col <= iAdjRight ; Col ++ )<BR> {<BR> iTempCol = Col - iHalfWidth ;<BR><BR> for ( i = 0 ; i < NeighberhoodColumns ; i ++ )<BR> {<BR> for ( j = 0 ; j < NeighberhoodRows ; j ++ )<BR> ipBlock [ i * NeighberhoodColumns + j ]<BR> =( *( hpSrcImage + ( iTempRow + i ) * Width + iTempCol + j ) );<BR> }<BR><BR> // 快速排序<BR> qsort( ipBlock , (unsigned)(NeighberhoodRows * NeighberhoodColumns) ,<BR> sizeof ( int ) , _iIntCmpFunc );<BR><BR> *( hpDestImage + ( Row - top ) * iDestWidth + Col - left )<BR> = ipBlock [ iHalfHeight * NeighberhoodColumns + iHalfWidth ];<BR> }<BR> }<BR> free ( ipBlock );<BR>}<BR><BR>static int _iIntCmpFunc( const void * i1 , const void * i2 )<BR>{<BR> return *(int *)i1 - *(int *)i2 ;<BR>}<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:松鼠 回复日期:2003-07-18 23:23:23
<br>内容:刚才敲了一大堆,一不小心按了ESC键,屏幕就空白了。有人有什么建议能恢复么?<BR>(不要跟我说Ctrl-Y,我已经试过了)<BR><BR>平时我们所说的编译软件,其实分成两步:<BR>1,Compile,检查语法错误,检查函数有没有定义等等。比如说这个程序<BR>///////begin 程序1<BR>main()<BR>{<BR>hello();<BR>}<BR>//////end<BR>这个程序就会出现Compile错误,告诉你hello()没有定义。改成<BR>/////begin 程序2<BR>void hello();<BR>main()<BR>{<BR>hello();<BR>}<BR>就能通过这步了。<BR><BR>2,link 这步在编译之后,把程序里用到的外部函数(例如printf等)的真正内容,链接进来。如果像程序2那样,找不到hello()的函数体,就出现错误了。<BR>//////begin 程序3<BR>void hello();<BR>main()<BR>{<BR>hello();<BR>}<BR>hello()<BR>{<BR>return;<BR>}<BR>////////end<BR>这样就不会出现link错误了。<BR><BR>祝:<BR>编安!<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ophir 回复日期:2003-07-19 10:29:29
<br>内容:金玉良言!谢
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -