在VS2010中使用CPLEX的访问冲突写入位置
Access Violation writing location using CPLEX with VS2010
我是C编程新手。我在使用visual studio 2010的c++代码中运行CPLEX库。我在执行某些操作时遇到访问违规。
在CRT文件mlock.c中定义的void __cdecl _unlock函数中报告该违规。具体的行是leaveccriticalsection (_locktable[locknum])。锁);。
错误信息为Unhandled exception at 0x0f63443b: 0xC0000005: Access violation writing location 0xeb43c7c4。我的解释是,这是一个记忆相关的问题,但我不确定。此外,我不知道如何跟踪代码中的内存块0xeb43c7c4。
下面是调用栈:
cplex124.dll!0fdd443b()
[Frames below may be incorrect and/or missing, no symbols loaded for cplex124.dll]
cplex124.dll!0fdd3bbb()
cplex124.dll!0fcd0610()
cplex124.dll!0fccfbfd()
cplex124.dll!0feb70fd()
cplex124.dll!0fede883()
> name.exe!_unlock(int locknum) Line 375 C
name.exe!_unlock_file2(int i, void * s) Line 356 + 0x9 bytes C
name.exe!printf(const char * format, ...) Line 68 + 0x10 bytes C
name.exe!main(int argc, char * * argv) Line 620 + 0xe bytes C++
name.exe!__tmainCRTStartup() Line 278 + 0x12 bytes C
kernel32.dll!7693ed6c()
ntdll.dll!7701377b()
ntdll.dll!7701374e()
_unlock的源代码在mlock.c文件中:
void __cdecl _unlock (
int locknum
)
{
/*
* leave the critical section.
*/
LeaveCriticalSection( _locktable[locknum].lock );
}
#ifdef _M_IX86
#pragma optimize("y",on)
#endif /* _M_IX86 */
printf的源代码在printf.c文件中:
int __cdecl printf (
const char *format,
...
)
/*
* stdout 'PRINT', 'F'ormatted
*/
{
va_list arglist;
int buffing;
int retval;
_VALIDATE_RETURN( (format != NULL), EINVAL, -1);
va_start(arglist, format);
_lock_str2(1, stdout);
__try {
buffing = _stbuf(stdout);
retval = _output_l(stdout,format,NULL,arglist);
_ftbuf(buffing, stdout);
}
__finally {
_unlock_str2(1, stdout);
}
return(retval);
}
如果我在项目属性中删除音乐会文件的链接,我得到相同的错误信息,但在文件tidtable.c中,在_CRTIMP PFLS_GETVALUE_FUNCTION __cdecl __set_flsgetvalue()在线:PFLS_GETVALUE_FUNCTION flsGetValue = FLS_GETVALUE;
如有任何建议,我将不胜感激。
谢谢。
Cplex是一个商业求解器库。他们可能会发布您提到的几个不同版本的DLL,以符合各种构建类型。
此外,这种类型的库通常在您可以定义的预处理器定义方面给您提供了一点灵活性。有关详细信息,请参阅cplex文档。不匹配的定义会导致这样的错误,就像使用不支持多线程的运行时和支持多线程的库一样。如果CPLEX被证明有问题,我还建议看看GLPK, GNU线性编程工具包作为一个开源的替代方案。
相关文章:
- 写入位置0x0000000C时发生访问冲突
- 0xC0000005:访问冲突写入位置0xCDCDCDCD动态分配错误
- 0xC0000005:访问冲突读取位置 0x00000000. 重载 == 运算符的问题
- (此函数用于计算 SMA).在 FA.exe 中0x00509159引发异常: 0xC0000005:访问冲突读取位置0
- 0xC0000005:读取位置0xCDCDCDC1时发生访问冲突
- 0xC0000005:读取位置0xCDCDCDCD时发生访问冲突
- 读取类的析构函数中的位置时发生访问冲突
- 在尝试使用CUDA分配内存时,我遇到了访问冲突写入位置错误
- 创建 2D 数组0xCCCCCCCC访问冲突写入位置
- 0x0F50DF58:0xC0000005:访问冲突读取位置0x0047CA04时未处理的异常
- 在 DLL 中嵌入 Python:Py_DECREF列表对象时访问冲突读取位置
- 在 C 代码中调用 Python 函数时第三次出现访问冲突写入位置错误
- 0xC0000005:访问冲突读取位置0x0000000000000008
- 使用动态数组访问冲突写入位置
- C++访问冲突读取位置0xDDDDDDCD当我尝试删除已更新的数组时
- 使用向量的函数崩溃,调试器说访问冲突读取位置
- vc++ 访问冲突读取位置
- C++ - 智能指针 - 访问冲突读取位置0xDDDDDDDD
- C++访问冲突读取位置错误
- 调用隔离后访问冲突执行位置0x0000000000000000:New()