나는 내가 비주얼 스튜디오에서 직접 프로그램을 실행하지만 .exe 파일을 구축하고 독립으로 실행할 때 오류관리 및 믹싱 관리되지 않는 코드 문제
다음받을 때 작동하는 다음 코드System::Void MainForm::initLoadCell(){
//Open the first found LabJack U3 over USB.
lngErrorcode = OpenLabJack (LJ_dtU3, LJ_ctUSB, "1", TRUE, &lngHandle);
//Load defualt config
lngErrorcode = ePut (lngHandle, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0);
//Setup FIO0 as an analogue input port
lngErrorcode = ePut (lngHandle, LJ_ioPUT_ANALOG_ENABLE_BIT,0,1,0);
//Obtain error string
char* errorcode = new char;
ErrorToString(lngErrorcode, errorcode);
// Convert the c string to a managed String.
String^errorString = Marshal::PtrToStringAnsi((IntPtr) (char *) errorcode);
MainForm::textBox_LoadCellError->Text = errorString;
Marshal::FreeHGlobal((IntPtr)errorcode);
}
에게 있습니다
Problem signature:
Problem Event Name: APPCRASH
Application Name: BenchTester.exe
Application Version: 0.0.0.0
Application Timestamp: 52f4c0dd
Fault Module Name: ntdll.dll
Fault Module Version: 6.1.7601.18247
Fault Module Timestamp: 521ea8e7
Exception Code: c0000005
Exception Offset: 0002e3be
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 3081
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
나는 그것이이 세번째로 전화입니다
ErrorToString(lngErrorcode, errorcode);
다음 줄에 의해 발생 것을 알고있다 파티 코드, 난 그 코드와 함께 관리되지 않는 코드를 정확하게 다루지 않는 오류가 있다고 가정하지만 나는 확신 할 수 없다. 누군가가 올바른 방향으로 나를 가리켜 주시겠습니까?
실제로 도움이되지만 문제를 해결하지 못했지만 고맙습니다. 새로운 크기의 문자를 사용하여 필요한 크기를 만들 수 있다고 생각했습니다. 어쨌든 불행하게도 여전히 오류가 있습니다. 제 3 자 하드웨어가 실제로 .net 래퍼와 함께 제공되는 것을 발견했습니다. – codem
더 나은 점은 :'char errorCode [1024];'필요없는 경우 동적 할당을 피하십시오. –