首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

release编译停和直接运行EXE的结果不同

2013-09-28 
release编译下和直接运行EXE的结果不同问题是这样的,我有段程序是计算图像的直方图然后显示。在编译状态下,

release编译下和直接运行EXE的结果不同
问题是这样的,我有段程序是计算图像的直方图然后显示。在编译状态下,无论debug还是release结果都是正确的,直接运行debug生成的exe也是正确的,但直接运行release生成的exe结果就不正确。看论坛里前段时间有人问过,按照一些大侠的回复试了下,但还是不行。
[解决办法]
怎么个不正确你要说下啊
[解决办法]
请检查是否存在临时变量未初始化被使用,Debug与Release不一样比较多是因为这个。
[解决办法]
在编译状态下,无论debug还是release结果都是正确的
直接运行debug生成的exe也是正确的
但直接运行release生成的exe结果就不正确

——把release生成的exe放到debug文件夹下运行试试
[解决办法]
检查是否有一些相对路径的存在,还有就是有些地方需要一定的延迟。

引用:
问题是这样的,我有段程序是计算图像的直方图然后显示。在编译状态下,无论debug还是release结果都是正确的,直接运行debug生成的exe也是正确的,但直接运行release生成的exe结果就不正确。看论坛里前段时间有人问过,按照一些大侠的回复试了下,但还是不行。

[解决办法]
重建所有。
用depends.exe查看exe依赖的dll所在目录及其版本号。
[解决办法]
还有就是添加日志文件,关键的地方输入信息到文件中,这样可以缩小问题的范围。

引用:
Quote: 引用:

检查是否有一些相对路径的存在,还有就是有些地方需要一定的延迟。

Quote: 引用:

问题是这样的,我有段程序是计算图像的直方图然后显示。在编译状态下,无论debug还是release结果都是正确的,直接运行debug生成的exe也是正确的,但直接运行release生成的exe结果就不正确。看论坛里前段时间有人问过,按照一些大侠的回复试了下,但还是不行。


没有关于路径的操作。

[解决办法]
SetCurrentDirectory
The SetCurrentDirectory function changes the current directory for the current process. 

BOOL SetCurrentDirectory(
  LPCTSTR lpPathName   // pointer to name of new current directory
);
 
Parameters
lpPathName 
Pointer to a null-terminated string that specifies the path to the new current directory. This parameter may be a relative path or a fully qualified path. In either case, the fully qualified path of the specified directory is calculated and stored as the current directory. 
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. 

Remarks
Each process has a single current directory made up of two parts: 

A disk designator that is either a drive letter followed by a colon, or a server name and share name (\\servername\sharename) 
A directory on the disk designator 
QuickInfo
  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winbase.h.
  Import Library: Use kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also
File I/O Overview, File Functions, GetCurrentDirectory 

 

热点排行