求大佬帮看一段程序,不知道错在哪里了

lee益阳 2019-04-14 02:29:38

做这个细胞检测与计数系统时候,做到最后一部把图片添加进去总是报错,看不懂程序在哪有问题。求帮助,谢谢
/***
*crtexe.c - Initialization for console EXE using CRT DLL
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This is the actual startup routine for apps linking to the CRT DLL.
* It calls the user's main routine [w]main() or [w]WinMain after
* performing C Run-Time Library initialization.
*
* With ifdefs, this source file also provides the source code for:
* wcrtexe.c the startup routine for console apps with wide chars
* crtexew.c the startup routine for Windows apps
* wcrtexew.c the startup routine for Windows apps with wide chars
*
*******************************************************************************/

#ifdef CRTDLL

/*
* SPECIAL BUILD MACROS! Note that crtexe.c (and crtexew.c) is linked in with
* the client's code. It does not go into crtdll.dll! Therefore, it must be
* built under the _DLL switch (like user code) and CRTDLL must be undefined.
* The symbol SPECIAL_CRTEXE is turned on to suppress the normal CRT DLL
* definition of _fmode and _commode using __declspec(dllexport). Otherwise
* this module would not be able to refer to both the local and DLL versions
* of these two variables.
*/

#undef CRTDLL
#ifndef _DLL
#define _DLL
#endif /* _DLL */

#define SPECIAL_CRTEXE

#include <cruntime.h>
#include <oscalls.h>
#include <awint.h>
#include <internal.h>
#include <process.h>
#include <math.h>
#include <rterr.h>
#include <stdlib.h>
#include <tchar.h>
#include <rtcapi.h>
#include <sect_attribs.h>
#include <locale.h>

extern IMAGE_DOS_HEADER __ImageBase;

/*
* This has been moved from unhandld.cpp to here because, we only
* want to set the UnhandledExceptionFilter when this crt is loaded
* by an EXE (ie. not loaded by a DLL)
*/
int __cdecl __CxxSetUnhandledExceptionFilter(void);
_CRTALLOC(".CRT$XIY") static _PIFV pinit = &__CxxSetUnhandledExceptionFilter;

#define SPACECHAR _T(' ')
#define DQUOTECHAR _T('\"')

/* default floating point precision - X86 only! */

#ifdef _M_IX86
extern void _setdefaultprecision();
#endif /* _M_IX86 */


/*
* Declare function used to install a user-supplied _matherr routine.
*/
_CRTIMP void __setusermatherr( int (__cdecl *)(struct _exception *) );


/*
* Declare the names of the exports corresponding to _fmode and _commode
*/
#ifdef _M_IX86

#define _IMP___FMODE _imp___fmode
#define _IMP___COMMODE _imp___commode

#else /* _M_IX86 */

/* assumed to be x64 or ARM */

#define _IMP___FMODE __imp__fmode
#define _IMP___COMMODE __imp__commode

#endif /* _M_IX86 */

extern int * _IMP___FMODE; /* exported from the CRT DLL */
extern int * _IMP___COMMODE; /* these names are implementation-specific */

extern int _fmode; /* must match the definition in <stdlib.h> */
extern int _commode; /* must match the definition in <internal.h> */
extern int _dowildcard; /* passed to __getmainargs() */

/*
* Declare/define communal that serves as indicator the default matherr
* routine is being used.
*/
int __defaultmatherr;

/*
* routine in DLL to do initialization (in this case, C++ constructors)
*/
extern int __cdecl _initterm_e(_PIFV *, _PIFV *);
extern void __cdecl _initterm(_PVFV *, _PVFV *);

#ifndef _CRT_APP
/*
* routine to check if this is a managed application
*/
static int __cdecl check_managed_app(void);
#endif /* _CRT_APP */

/*
* pointers to initialization sections
*/
extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[];
extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; /* C initializers */
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[]; /* C++ initializers */

/*
* Pointer to callback function to initialize any dynamically initialized
* __declspec(thread) variables. This relies on a subtle aspect of C.
* The pointer is defined here uninitialized. It is defined initialized in
* tlsdyn.c. If user code uses dynamically initialized __declspec(thread)
* variables, then compiler-injected dependencies cause tlsdyn.obj to be
* linked. In that case, the non-zero definition of __dyn_tls_init_callback
* in tlsdyn.obj will take precedence, and the startup code will execute the
* callback. This use of multiple definitions is only legal in C, not C++.
*/

const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;

/*
* Pointers to beginning and end of the table of function pointers manipulated
* by _onexit()/atexit(). The atexit/_onexit code is shared for both EXE's and
* DLL's but different behavior is required. These values are set to -1 to
* mark this module as an EXE.
* NOTE - the pointers are stored encoded.
*/

extern _PVFV *__onexitbegin;
extern _PVFV *__onexitend;

/*
* All the below variables are made static global for this file. This facilitates
* in communicating mainCRTStartup and initialization code. Along with making these
* variables global, two new functions are created pre_c_init, pre_cpp_init. The functions
* are executed before anything in c_init and cpp_init sections repsectively.
*/
static int argc; /* three standard arguments to main */
static _TSCHAR **argv;
static _TSCHAR **envp;
static int argret;
static _startupinfo startinfo;
static int has_cctor = 0;
static int mainret = 0;
static int managedapp = 0;

static int __cdecl pre_c_init(void);
static void __cdecl pre_cpp_init(void);

_CRTALLOC(".CRT$XIAA") static _PIFV pcinit = pre_c_init;
_CRTALLOC(".CRT$XCAA") static _PVFV pcppinit = pre_cpp_init;


#ifdef _CRT_APP
/*
* Forward declaration for WinRT initialization API
*/
long __stdcall RoInitialize(int);

/*
* CRT App WinRt initialization type
*/
extern int __crtWinrtInitType;

#if defined(_KERNELX)
/*
* HModule for combase.dll
*/
static HMODULE hModComBase;

/***
*app_uninit(void)
*
*Purpose:
* Called up by atexit() to free the combase.dll HModule
*
*Entry:
*
*Exit:
*
*******************************************************************************/
static void __cdecl app_uninit(void)
{
if (hModComBase)
{
FreeLibrary(hModComBase);
hModComBase = INVALID_HANDLE_VALUE;
}
}
#endif /* defined(_KERNELX) */

#if defined(_KERNELX)
typedef HRESULT (WINAPI *PFN_RO_INITIALIZE)(_In_ WINRT_INIT_TYPE);
#endif /* defined(_KERNELX) */

/***
*app_init(void)
*
*Purpose:
* The code initializes WinRt for CRT App depending on __crtWinrtInitType value
*
*Entry:
*
*Exit:
* Return S_OK if succeeded, otherwise the failure as an HRESULT
*******************************************************************************/
static HRESULT __cdecl app_init(void)
{
if (__crtWinrtInitType != 0)
{
HRESULT hr = E_FAIL;
#if !defined(_KERNELX)
hr = RoInitialize(1 /* RO_INIT_MULTITHREADED */);
#else
hModComBase = LoadLibraryExW(L"combase.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hModComBase)
{
PFN_RO_INITIALIZE pfnRoInitialize = (PFN_RO_INITIALIZE) GetProcAddress(hModComBase, "RoInitialize");
if (pfnRoInitialize)
hr = pfnRoInitialize(1 /* RO_INIT_MULTITHREADED*/);
atexit(app_uninit);
}
#endif /* !defined (_KERNELX) */
if (FAILED(hr))
return hr;
}

return S_OK;
}

#endif /* _CRT_APP */

/* Make sure intrinsics work on x86 as well */
#if defined (_M_IX86)

#undef _InterlockedExchangePointer
#undef _InterlockedCompareExchangePointer

#define _InterlockedExchangePointer(_Target, _Value) (void*)(_InterlockedExchange( \
(long volatile *)(_Target), \
(long)(_Value)))

#define _InterlockedCompareExchangePointer(_Target, _Exchange, _Comparand) (void *)(_InterlockedCompareExchange( \
(long volatile *)(_Target), \
(long)(_Exchange), \
(long)(_Comparand)))

#endif /* defined (_M_IX86) */

/***
*pre_c_init(void)
*
*Purpose:
* The code in mainCRTStartup that was executed before executing C
* initializers was shifted in this function. Also this funciton is the
* first thing that is executed in c init section.
*
*Entry:
*
*Exit:
*
*******************************************************************************/

static int __cdecl pre_c_init(void)
{
#ifndef _CRT_APP
/*
* Determine if this is a managed application
*/
managedapp = check_managed_app();
#endif /* _CRT_APP */

#if !defined(_CRT_APP) || defined(_KERNELX)
/*
* Set __app_type properly
*/
#ifdef _WINMAIN_
__set_app_type(_GUI_APP);
#else /* _WINMAIN_ */
__set_app_type(_CONSOLE_APP);
#endif /* _WINMAIN_ */
#endif /* !defined(_CRT_APP) || defined(_KERNELX) */

/*
* Mark this module as an EXE file so that atexit/_onexit
* will do the right thing when called, including for C++
* d-tors.
*/
__onexitbegin = __onexitend = (_PVFV *) EncodePointer((_PVFV *)(-1));

/*
* Propogate the _fmode and _commode variables to the DLL
*/
*_IMP___FMODE = _fmode;
*_IMP___COMMODE = _commode;

/*
* Run the RTC initialization code for this DLL
*/
#if defined (_RTC)
_RTC_Initialize();
#endif /* defined (_RTC) */

/*
* Call _setargv(), which will trigger a call to __setargv() if
* SETARGV.OBJ is linked with the EXE. If SETARGV.OBJ is not
* linked with the EXE, a dummy _setargv() will be called.
*/
#ifdef WPRFLAG
_wsetargv();
#else /* WPRFLAG */
_setargv();
#endif /* WPRFLAG */

/*
* If the user has supplied a _matherr routine then set
* __pusermatherr to point to it.
*/
if ( !__defaultmatherr )
__setusermatherr(_matherr);

#ifdef _M_IX86
_setdefaultprecision();
#endif /* _M_IX86 */

/* Enable per-thread locale if user asked for it */
if(__globallocalestatus == -1)
{
_configthreadlocale(-1);
}

#if defined (_CRT_APP)
app_init();
#endif /* defined (_CRT_APP) */
return 0;
}

/***
*pre_cpp_init(void)
*
*Purpose:
* The code
...全文
658 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
QQ515311445 2019-07-19
  • 打赏
  • 举报
回复
得整个工程调试才知道,这样是看不出来的
uianster 2019-05-01
  • 打赏
  • 举报
回复
你这代码粘的,谁能看得懂
lx624909677 2019-04-16
  • 打赏
  • 举报
回复
点一下中断,然后看下堆栈调用窗口,找到自己的代码,然后看看具体是哪里蹦了
lee益阳 2019-04-14
  • 打赏
  • 举报
回复
真的很急,礼拜1要交作业,现在半夜2点还没调整完

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧