VC6 静态编译的Release程序,编译通过运行报错

Linking...
nafxcw.lib(wincore.obj) : error LNK2005: _InitMultipleMonitorStubs already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _xGetSystemMetrics@4 already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _xMonitorFromPoint@12 already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _xMonitorFromRect@8 already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _xMonitorFromWindow@8 already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _xGetMonitorInfo@8 already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _xEnumDisplayMonitors@16 already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_fMultiMonInitDone already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnEnumDisplayMonitors already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnGetMonitorInfo already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromPoint already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromRect already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromWindow already defined in PPTooltip.obj
nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnGetSystemMetrics already defined in PPTooltip.obj
C:\Program Files (x86)\HTDriver\20407\HT_USBKeyTool_R.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

*************.exe - 15 error(s), 3 warning(s)

然后 我给Release配置: Link的命令行中增加这个命令 /FORCE:MULTIPLE。编译可以通过,但是有如下警告:

Linking...
nafxcw.lib(wincore.obj) : warning LNK4006: _InitMultipleMonitorStubs already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _xGetSystemMetrics@4 already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _xMonitorFromPoint@12 already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _xMonitorFromRect@8 already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _xMonitorFromWindow@8 already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _xGetMonitorInfo@8 already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _xEnumDisplayMonitors@16 already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_fMultiMonInitDone already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnEnumDisplayMonitors already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnGetMonitorInfo already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromPoint already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromRect already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromWindow already defined in PPTooltip.obj; second definition ignored
nafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnGetSystemMetrics already defined in PPTooltip.obj; second definition ignored
C:\Program Files (x86)\HTDriver\20407\HT_USBKeyTool_R.exe : warning LNK4088: image being generated due to /FORCE option; image may not run

***************.exe - 0 error(s), 18 warning(s)

然后运行这个exe,程序报错退出……

哪位大神知道这个问题怎么解决呢,谢谢!

4个回答

nafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromWindow already defined in PPTooltip.obj

这个上面不是说了:在生成nafxcw.lib 的时候 ,链接出错了。 wincore文件里 的一些函数 链接的时候检查到 PPTooltip 文件里已经定义了。 你看下这两个文件 。 是不是都定义了 g_pfnMonitorFromWindow。 一类的。 检查下这两个文件

cai_huan_123
欢香Love 谢谢你的提醒, 我包含了这个头文件:#include "multimon.h", 这个头文件里定义了上述那些警告的函数,谢谢
大约一年之前 回复

先看项目配置,试着把release的优化选项全部关闭,然后逐步打开。

这样看代码很难看出什么原因的。

cai_huan_123
欢香Love 谢谢
大约一年之前 回复

CRT 库对 new、delete 和 DllMain 函数使用弱外部链接。MFC 库也包含 new、delete 和 DllMain 函数。这些函数要求先链接 MFC 库,然后再链接 CRT 库。
当 C 运行时 (CRT) 库和 Microsoft 基础类 (MFC) 库的链接顺序有误时,可能会出现以下 LNK2005 错误。
解决方法:
强制链接器按照正确的顺序链接库!

cai_huan_123
欢香Love 谢谢
大约一年之前 回复

看下代码和一些细节有没有错误的地方
当 C 运行时 (CRT) 库和 Microsoft 基础类 (MFC) 库的链接顺序有误时,可能会出现以下 LNK2005 错误。

cai_huan_123
欢香Love 谢谢
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
VC6 静态编译的Release程序,编译通过运行报错
Linking...nnafxcw.lib(wincore.obj) : error LNK2005: _InitMultipleMonitorStubs already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _xGetSystemMetrics@4 already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _xMonitorFromPoint@12 already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _xMonitorFromRect@8 already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _xMonitorFromWindow@8 already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _xGetMonitorInfo@8 already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _xEnumDisplayMonitors@16 already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_fMultiMonInitDone already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_pfnEnumDisplayMonitors already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_pfnGetMonitorInfo already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromPoint already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromRect already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_pfnMonitorFromWindow already defined in PPTooltip.objnnafxcw.lib(wincore.obj) : error LNK2005: _g_pfnGetSystemMetrics already defined in PPTooltip.objnC:\Program Files (x86)\HTDriver\20407\HT_USBKeyTool_R.exe : fatal error LNK1169: one or more multiply defined symbols foundnError executing link.exe.nn*************.exe - 15 error(s), 3 warning(s)nn然后 我给Release配置: Link的命令行中增加这个命令 /FORCE:MULTIPLE。编译可以通过,但是有如下警告:nnLinking...nnafxcw.lib(wincore.obj) : warning LNK4006: _InitMultipleMonitorStubs already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _xGetSystemMetrics@4 already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _xMonitorFromPoint@12 already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _xMonitorFromRect@8 already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _xMonitorFromWindow@8 already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _xGetMonitorInfo@8 already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _xEnumDisplayMonitors@16 already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_fMultiMonInitDone already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnEnumDisplayMonitors already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnGetMonitorInfo already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromPoint already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromRect already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnMonitorFromWindow already defined in PPTooltip.obj; second definition ignorednnafxcw.lib(wincore.obj) : warning LNK4006: _g_pfnGetSystemMetrics already defined in PPTooltip.obj; second definition ignorednC:\Program Files (x86)\HTDriver\20407\HT_USBKeyTool_R.exe : warning LNK4088: image being generated due to /FORCE option; image may not runnn***************.exe - 0 error(s), 18 warning(s)nn然后运行这个exe,程序报错退出……nn哪位大神知道这个问题怎么解决呢,谢谢!
百度地图编译通过运行报错
![图片说明](https://img-ask.csdn.net/upload/201603/27/1459067238_93898.png)nn在学习百度地图的使用按照别人的demo敲的不知道为什么会出现错误哪位前辈帮忙看一下.nnError:(27, 22) 错误: 无法将类 BMapManager中的构造器 BMapManager应用到给定类型;n需要: 没有参数n找到: MainActivityn原因: 实际参数列表和形式参数列表长度不同nnError:(31, 20) 错误: 无法将类 BMapManager中的方法 init应用到给定类型;n需要: 没有参数n找到: String,n原因: 实际参数列表和形式参数列表长度不同
编译好的程序运行报错
我在WIN7下用VS2010编译32bits的程序,但是在运行时报错“应用程序发生异常0xc0000409位置为0x00611288”这是什么错rn?应该怎么改?我最开始的程序都没有这个错误的~但是修改了一些代码之后哦在WIN7上运行良好,但是xp却报错了。
libxml编译通过,但是运行报错!!!
我在linux下编写了一个小程序试试rn编译可以通过rn其中用到了xmlReadFile函数rn但是运行时候报错rn./a.out relocation error:./a.out:undefined symbol:xmlReadFilern请问是怎么回事》???
VC6 编译通过 贪吃蛇
VC6 环境下编译通过的Windows小游戏,贪吃蛇。 大家可以随便看看。
VC6如何实现静态编译
RT
USB驱动界面程序,VC6编译通过
USB开发与应用,主要是界面编程,非常好的可以看看
QT5.5.0静态编译套件release版
下载后在qt creator build&run 里的QtVersions里,添加版本en,就是解压后bin文件夹下的qmake文件。 然后在Kit里添加套件 名称可以自己定; 调试器选None; Qt版本选刚刚添加的; 其他的不用管
Release编译通过,Debug编译不过!怪!?
在链接的时候出错。rnLinking...rnuuid.lib(objidl_i.obj) : fatal error LNK1103: debugging information corrupt; recompile modulernError executing link.exe.rnrn谁有没有碰过呀?rn
gloox-0.9.9.12_vc6.rar,VC6亲自编译通过
1、亲自从官网http://camaya.net/gloox/download下载的版本。 2、配置依赖的LIB。 3、仅去除一个无效的头文件。 4、增加myTest空类。 5、编译生成DLL。
debag编译能通过,release编译通不过
#include "comutil.h"rnrnsetting ->comsupp.lib rnrnrn char * chrsubkey =NULL;rn chrsubkey = _com_util::ConvertBSTRToString((_bstr_t)subkey);rnrn为什么?rnrnLinking...rn Creating library ReleaseMinSize/APLJet.lib and object ReleaseMinSize/APLJet.exprnLIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _mainrnReleaseMinSize/APLJet.dll : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rn
linux 下编译错误(vc6通过编译)
提示 :rng++ -I. -D_REENTRANT -D_SEND_ALL __TRCODE -DLINUX -g -Wall -Wa, -a, -ad -c readRdate.cpp -o readRdate.o >>dev-virtualRadar-linux.codrng++ cannot specify -o with -c or -S and multiple compilationsrnmake:*** [readRdate.o] Error l
NDK的sample里hello-gl2编译通过,运行报错
环境: windows+cygwin+eclipse+sdk2.2+ndkr5 原版sample无任何改动,编译成功。一旦进入模拟器运行时: 直接报错,退出。 求解…… 据说是模拟器不支持opengles2.0? 求帮助…… 如果是报错报的什么错误,粘贴一下log 。可以用真机再测试一下看看有没有问题 [url=http://www.buildapp.net/andr...
为什么用 SPRINTF 编译通过 运行报错??
#includern#includern//#includern#includernusing namespace std;rnvoid main()rn rn int a=1024;rn char length[5];rn rn sprintf(length,"%s",a);rn printf("%s",length);rnrnrn求解
新建的MFC工程,编译通过但运行报错
每次运行都报这个错,求大虾帮忙啊rn[img=https://img-bbs.csdn.net/upload/201311/01/1383287496_871475.jpg][/img]
VC6中如何设置静态编译?
把一些LIB静态编译进程序中,不在使用DLL。如何设置,请帮忙,谢谢!
关于OTL编译通过,运行报错的问题
关于OTL编译通过,运行报错的问题:rn代码如下:rn#include rn#include rn#include rn#define OTL_ORA9Irn#include "otlv4.h"rnusing namespace std;rnotl_connect db;rn#define CONNECTSTRING "tbas/tydic@ora9i"rnchar char_code[10]="0000";rnint main()rnrn otl_connect::otl_initialize(); rn db.rlogon(CONNECTSTRING); rn otl_stream select(10,"SELECT latn_name FROM latn where area_code=:char_code<11>",db);rn select<>c_name;rn cout<<"latn_name="<
类的运算重载,编译通过,运行报错
#includernusing namespace std;rnclass Complex rnpublic:rnComplex( double , double = 0.0 ); rnComplex operator+( const Complex & ); rnComplex operator-( const Complex & ); rnprivate:rndouble real; rndouble imaginary; rn;rnrnComplex Complex::operator+(const Complex &operand2 ) rn return Complex( real + operand2.real,rn imaginary + operand2.imaginary ); rn;rnrnComplex Complex::operator- (const Complex & operand2 )rn return Complex( real - operand2.real,rn imaginary - operand2.imaginary ); rn;rnrnvoid main()rnrnrnrnrnrnrnrn错误rnc.obj : error LNK2001: unresolved external symbol "public: __thiscall Complex::Complex(double,double)" (??0Complex@@QAE@NN@Z)rnDebug/ads.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.
编译通过,运行报错,请高手指导,谢谢!
H:\Java\Project\test>runrnException in thread "main" java.lang.NoClassDefFoundError: org/snmp4j/TransportMappingrnCaused by: java.lang.ClassNotFoundException: org.snmp4j.TransportMappingrn at java.net.URLClassLoader$1.run(URLClassLoader.java:202)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:190)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:307)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:248)rnCould not find the main class: SnmpExample. Program will exit.rnrnrn为什么编译通过,运行的时候总是报这个错误呀?rnrn============================================================================================rnimport java.io.IOException;rnrnimport org.snmp4j.*;rnimport org.snmp4j.event.ResponseEvent;rnimport org.snmp4j.event.ResponseListener;rnimport org.snmp4j.mp.MPv3;rnimport org.snmp4j.mp.SnmpConstants;rnimport org.snmp4j.security.*;rnimport org.snmp4j.smi.Address;rnimport org.snmp4j.smi.GenericAddress;rnimport org.snmp4j.smi.OID;rnimport org.snmp4j.smi.OctetString;rnimport org.snmp4j.smi.UdpAddress;rnimport org.snmp4j.smi.VariableBinding;rnimport org.snmp4j.transport.DefaultUdpTransportMapping;rnrnpublic class SnmpExample rn private Snmp snmp = null;rn private String version=null;rn /**rn *rn * @param versionrn */rn public SnmpExample(String version) rn try rn this.version=version;rn TransportMapping transport = new DefaultUdpTransportMapping();rn snmp = new Snmp(transport);rn if(version.equals("3"))rn rn //设置安全模式rn USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(rn MPv3.createLocalEngineID()), 0);rn SecurityModels.getInstance().addSecurityModel(usm);rn rn //开始监听消息rn transport.listen();rn catch (IOException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn/**rn *rn * @param syn 是否是同步模式rn * @param bro 是否是广播rn * @param pdu 要发送的报文rn * @param addr 目标地址rn * @throws IOExceptionrn */rn public void sendMessage(Boolean syn, final Boolean bro, PDU pdu,rn String addr) throws IOException rn //生成目标地址对象rn Address targetAddress = GenericAddress.parse(addr);rn Target target=null;rn if(version.equals("3"))rn rn //添加用户rn snmp.getUSM().addUser(rn new OctetString("MD5DES"),rn new UsmUser(new OctetString("MD5DES"), AuthMD5.ID,rn new OctetString("MD5DESUserAuthPassword"), PrivDES.ID,rn new OctetString("MD5DESUserPrivPassword")));rn rn target = new UserTarget();rn //设置安全级别rn ((UserTarget)target).setSecurityLevel(SecurityLevel.AUTH_PRIV);rn ((UserTarget)target).setSecurityName(new OctetString("MD5DES"));rn target.setVersion(SnmpConstants.version3);rn elsern target=new CommunityTarget();rn if(version.equals("1"))rn rn target.setVersion(SnmpConstants.version1);rn ((CommunityTarget) target).setCommunity(new OctetString("public"));rn elsern target.setVersion(SnmpConstants.version2c);rn ((CommunityTarget) target).setCommunity(new OctetString("public"));rn rn rn rn // 目标对象相关设置rn target.setAddress(targetAddress);rn target.setRetries(5);rn target.setTimeout(1000);rn rn rn if (syn.equals(true)) rn //发送报文 并且接受响应rn ResponseEvent response = snmp.send(pdu, target);rn //处理响应rn System.out.println("Synchronize message from "rn + response.getPeerAddress() + "\nrequest:"rn + response.getRequest() + "\nresponse:"rn + response.getResponse());rn else rn //设置监听对象rn ResponseListener listener = new ResponseListener() rnrn @Overridern public void onResponse(ResponseEvent event) rn // TODO Auto-generated method stubrn if (bro.equals(false)) rn ((Snmp) event.getSource()).cancel(event.getRequest(),rn this);rn rn //处理响应rn PDU request = event.getRequest();rn PDU response = event.getResponse();rn System.out.println("Asynchronise message from "rn + event.getPeerAddress() + "\nrequest:" + requestrn + "\nresponse:" + response);rn rnrn ;rn //发送报文rn snmp.send(pdu, target, null, listener);rn rn rnrn public static void main(String[] args) rn SnmpExample manager = new SnmpExample("2c");rn //构造报文rn PDU pdu = new PDU();rn// PDU pdu = new ScopedPDU();rn //设置要获取的对象IDrn OID oids=new OID("1.3.6.1.2.1.1.1.0");rn pdu.add(new VariableBinding(oids));rn //设置报文类型rn pdu.setType(PDU.GETNEXT);rn // ((ScopedPDU) pdu).setContextName(new OctetString("priv")); rn try rn //发送消息 其中最后一个是想要发送的目标地址rn manager.sendMessage(false, true, pdu, "udp:192.168.2.249/161");rn catch (IOException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn
NDK samples里的hello-gl2编译通过运行报错
真机调试。rn运行至glAttachShader()的时候报错rnglAttachShader() glError (0x501)rnglAttachShader() glError (0x501)rn501是非法数值?rnrnGLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSrc);rn if (!vertexShader)rn rn return 0;rn rnrnGLuint fragmentShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSrc);rnif (!fragmentShader)rnrn return 0;rnrnrnGLuint program = glCreateProgram();rncheckGlError("glCreateProgram");rnif (program == 0) return 0;rnrnglAttachShader(program, vertexShader);rncheckGlError("glAttachShader");rnglAttachShader(program, fragmentShader);rncheckGlError("glAttachShader");
byte[] 数据如何存入数据库,程序编译通过,但运行报错
我要将一个 byte[] 类型的数据存入数据库,以下做了一下测试rnrnbyte[] byteArray = System.Text.Encoding.Default.GetBytes("20133");rnmodel.FingerCode = byteArray;rnmodel.GongHao = name;rnbll.Add(model);rnlabel2.Text = "登记成功.";rnrnvs 编译通过了,但是运行时报错,如下:rnrn------------------------------------------------------------------rnrnrn“System.Data.SqlClient.SqlException”类型的未经处理的异常在 DBUtility.dll 中发生 rnrn其他信息: 缺少对象或列名,或者对象或列名为空。对于 SELECT INTO 语句,请确保每列均具有名称。对于其他语句,请查找空的别名。不允许使用定义为 "" 或 [] 的别名。请添加名称或单个空格作为别名。 rnrn在此上下文中不允许使用名称 "System.Byte"。有效表达式包括常量、常量表达式和变量(在某些上下文中)。不允许使用列名。rnrn-------------------------------------------------------------------rnrnbyte[] 类型数据如何才能写入数据库呢,数据库中对应字段设为 binary(1024) 字段类型。rnrn请高手指教 ,万分感激!!rn
无法解析的外部符号--VC6编译通过,VS2005&2010编译都不通过
选择法排序,以下是VS2010下的错误信息rnrn错误 1 error LNK2019: 无法解析的外部符号 "class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class Sort const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$Sort@H@@@Z),该符号在函数 _main 中被引用 F:\Study\C&C++\C++\projects\sort\sort\sort.objrnrn错误 2 error LNK2019: 无法解析的外部符号 "class std::basic_istream > & __cdecl operator>>(class std::basic_istream > &,class Sort const &)" (??5@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$Sort@H@@@Z),该符号在函数 _main 中被引用 F:\Study\C&C++\C++\projects\sort\sort\sort.objrnrn[code=C/C++]rn#includernusing namespace std;rntemplaternclass Sortrnrn T *element;rn int size;rnpublic:rn Sort(int n);rn ~Sort();rn int find_min(int i);rn void arrange();rn friend ostream& operator<<(ostream& o, const Sort& s);rn friend istream& operator>>(istream& i, const Sort& s);rn;rntemplaternSort::Sort(int n)rnrn size=n;rn element=new T[size];rnrntemplaternSort::~Sort()rnrn delete[] element;rnrntemplaternint Sort::find_min(int i)rnrn int j,k=i;rn T temp=*(element+i);rn for(j=i+1;j*(element+j))rn rn temp=*(element+j);rn k=j;rn rn rn return k;rnrntemplaternvoid Sort::arrange()rnrn int i,k;rn T temp;rn for(i=0;irnostream& operator<<(ostream& o, const Sort& s)rnrn int i;rn for(i=0;irnistream& operator>>(istream& i,const Sort& s)rnrn int j;rn for(j=0;j>*(s.element+j);rn return i;rnrnrnvoid start_interface(void)rnrn cout<<"请选择想要排序的数据类型:"<>x;rn int n;rn cout<<"请输入数组长度:"<>n;rn cout<<"请输入"< s1(n);rn cin>>s1;rn s1.arrange();rn cout< s2(n);rn cin>>s2;rn s2.arrange();rn cout< s3(n);rn cin>>s3;rn s3.arrange();rn cout<
VC6的release版本问题
用VC6 写了一个软件,里面用到了MATLAB 的dll文件,编译出来的release版本exe在启动rn的时候会查找这些dll,如果没找到就启动不了><.rn现在我想知道怎么设置VC6让这个release 版本exe在启动的时候不查找这些dll只在用户用rn到MATLAB的时候去找?如果找不到就报错但是不退出软件...rn
vc6环境release下崩溃
debug运行不会崩溃,release下F5运行不会崩溃,但是ctrl+F5会崩溃,提示基础类应用程序已停止工作。rn在程序中加入messagebox调试发现每次出错的地方都不一样,而且有时又不会出错。rn监测了内存没有泄露,不明白为什么会出现这种问题?应该如何调试?
VC6 Release的程序无法在WinServer2003上执行
求教,是否有人碰到过同样问题,怎么解决的?rnVC6程序,Release版在WinServer2003 SP2中不能运行。rn具体情况是:双击.exe,可以看到进程列表里出现了我这个程序的进程,但是很快又消失了。rn程序始终无法执行,没有任何错误提示。rnrn但是同样的程序,Debug版可以运行。rnrnWinServer2003 SP2系统上装有VC6
VS2005的DEBUG可以编译成功,运行报错,Release的都没有问题
debug编译出的工程执行就崩溃。rn显示rnUnable to start program 'e:\program\test.exe'rnrnThis application has failed to start beacause the application configuration is incorrent.Review the manifest file for possible errors.Resinstalling the application may fix this problem.For more details,please see the application event log.rnrn以前可以编译执行的工程在Debug模式都无法执行。rnRelease的OK。重装过VS还是会出现这个问题。rn新建工程也会出现这个问题。
VS2005编译VC6的程序报错
原来一直用VC6. 现在项目需要用VC2005. 将原来在VC6下编译工作正常的程序移到VS2005下编译一大堆错误.rnerror C2664: 'A64ENC_INIT' : cannot convert parameter 2 from 'TCHAR [260]' to 'const char *'rn函数编译出错的地方是:rntypedef A64ENC_RESULT STDCALL A64ENC_INIT(rn const char *inPath,rn const char *outPath,rn int BitRate,rn A64ENC_INFO *pInfo);rn...rnA64ENC_INIT* m_pfnInit;rnTCHAR m_atszEncodedFile[260];rnrnif (m_pfnInit(ptszWavFile, m_atszEncodedFile, dwConvBitRate, &A64Info))rn以上这句报错:error C2664: 'A64ENC_INIT' : cannot convert parameter 2 from 'TCHAR [260]' to 'const char *'rn
VC6的程序在VC2005编译不过
正在编译资源清单... rn正在链接... rnLINK : warning LNK4076: 无效的增量状态文件“.\Debug/1单线life.ilk”;正在非增量链接 rnLINK : fatal error LNK1181: 无法打开输入文件“odbc32.lib” rn生成日志保存在“file://d:\Backup\我的文档\Visual Studio 2005\Projects\1单线life\Debug\BuildLog.htm” rn1单线life - 1 个错误,1 个警告 rn========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ========== rnrn大家说说要怎么改啊~谢谢大家了rnrn百度说要搞个指向odbc32.lib的路径,但是我把VC6都删了。难道要重装VC6?
vc6与VC2005 程序编译不通过
一个类库,在VC6下能编译过去,在05不能通过,错误为不能将const值赋给非constrn我看了看是return fun(..);这个地方出的问题,难道vc6连返回值为const时传给非const也不检查(自动强制去掉const),我觉得这个都不检查的话那vc6也太不合标准了吧,难道真的是这样?rnstatic WCHAR* _cstrchr(const WCHAR* p, WCHAR ch)rn return wcschr(p, ch); rnrn static WCHAR* _cstrrchr(const WCHAR* p, WCHAR ch)rn return wcsrchr(p, ch); rnrn static WCHAR* _cstrrev(WCHAR* pStr)rn return _wcsrev(pStr); rnrn static WCHAR* _cstrstr(const WCHAR* pStr, const WCHAR* pCharSet)rn return wcsstr(pStr, pCharSet); rnrn static int _cstrspn(const WCHAR* pStr, const WCHAR* pCharSet)rn return (int)wcsspn(pStr, pCharSet); rnrn static int _cstrcspn(const WCHAR* pStr, const WCHAR* pCharSet)rn return (int)wcscspn(pStr, pCharSet); rnrn static WCHAR* _cstrpbrk(const WCHAR* p, const WCHAR* lpszCharSet)rn return wcspbrk(p, lpszCharSet); rnrn出错的就在这些地方rnd:\projects\unittest\kk_base\kk_stringu.h(1875) : error C2440: “return”: 无法从“const char *”转换为“CHAR *”rn 转换丢失限定符rn这是错误rn请问这是编译器的问题,还是我设置的问题
程序运行报错
连接数据库提示:[00103]登陆数据库发生错误:Unknown error opening cursor,请与系统管理员联系!rnrn这个错误是程序登陆的时候报的,数据库是9i,用pb6.5也连不上,但是通过odbc可以连通。但是用pb9的话数据库可以连通,为什么呢,请各位大侠分析下原因。
求助:程序realease编译后运行报错
在debug模式下 去掉包 去掉rtl linker 运行没有任何问题rnrnrealease编译 去掉报 去掉rtl linker 运行时包内存错误!rnrn不得要领 请教!
android studio 编译运行报错:
Cannot reload AVD list: cvc-enumeration-valid: Value ‘280dpi’ is not facet-valid with respect to enumeration ‘[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]’. It must be a value from
程序运行报错!!!!
我编译测试程序的时候用rngcc -o test test.c -I /usr/local/include -liksemelrn编译通过rn但是运行的时候用rn#./test /home/test.xml 报错rn./test:error while loading shared librarys:libiksemel.so.3:can't open object file:no such file or directoryrnrnlibiksemel.so.3我明明在/usr/local/lib中看到了啊,怎么会打不开。请问是怎么回事啊????
编译正常,但是运行报错,
编译正常,但是运行报错,rnrn*p = 'h'; //这行正常呀rnrn*ptr = 'h'; //这一行,编译正常,运行报错rnrn同样的操作,为何前者正常,后者就报错呢rnrn[code=C/C++]rnrn#include "stdafx.h"rn#include rn#include rnusing namespace std;rnrnint main(int argc, char* argv[])rnrn char str[12] = "Hello";rn rn char *p = str;rn rn *p = 'h'; //这行正常呀rn cout << p << endl;rnrnrn char *ptr = "666Hello";rn *ptr = 'h'; //这一行,编译正常,运行报错rnrn cout << ptr << endl;rn return 0;rnrn[/code]
cmd下编译运行报错
程序在myeclipse下运行没有问题,可以得到正常的结果。可是在cmd下编译在运行则报错。rnjavac -cp f:\ojdbc14_g.jar f:\Hello.javarnjava -cp ,;ojdbc14_g.jar HellornException in thread "main" java.lang.NoClassDefFoundError: HellornCaused by: java.lang.ClassNotFoundException: Hellorn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rnCould not find the main class: Hello. Program will exit.rnrn网上查找说是环境变量的问题,但是检查没有发现。写最简单的程序编译也是可以运行的。ojdbc14_g.jar是数据库的jar包。rn程序代码见附件。rn此段代码是一个web项目中的一部分。现在是为了解决如下问题:rn通过shell脚本调用该项目中Hello.java的某一方法(当然目前才写完这段代码,对一些异常尚未处理,功能还没有做完),我的思路是在Hello中添加main方法然后将该类打包成jar然后写shell脚本调用。由于从为使用过shell脚本,也不知道该方法是否可行,或者是否有其他的更好的方法,求大神赐教。(原web项目中均是使用hibernate操作数据库,与下面的数据库连接不一样)。rnrn谢谢了!如果您有什么好的解决方式,请加我QQ393420225或者回帖。多谢!rn[code=java]rnrnimport java.io.BufferedInputStream;rnimport java.io.BufferedOutputStream;rnimport java.io.DataInputStream;rnimport java.io.DataOutputStream;rnimport java.io.FileOutputStream;rnimport java.io.IOException;rnimport java.io.UnsupportedEncodingException;rnrnimport java.net.InetSocketAddress;rnimport java.net.Socket;rnimport java.sql.Connection;rnimport java.sql.DriverManager;rnrnimport java.sql.Statement;rnimport java.text.SimpleDateFormat;rnimport java.util.Calendar;rnimport java.util.Date;rnrnrnpublic class Hellorn private String head1 = " 135500000000000000000000** 003";rn private String head2 = "000";rn private String head3 = "000000000";rn private String head4 = " 0000Y 0000000";rn private String tail = " " +rn "0000000000000000000000 00000000000000000" +rn " " +rn " " +rn " " +rn " ";rn private String successCode = "0000";rn private String errorCode = "0188";rn public void core009022()rn String icode = "009022";rn SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-ddhh:mm:ss");rn SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");rn String workTime = sdf1.format(new Date());rn String workday = sdf2.format(new Date());rn long date1 = new Date().getTime();rn String getWay = "qqq";rnrn rn String uuid = this.getUUID("02", "J", "8800501","009022");rn String head = head1+"77001"+head2+getUserNoStr("8800501")+icode+head3+workday+head4+"1"+uuid;rn String xmlstr ="\r\n111111111111" +rn "009022 " +rn head+"";rn String flag;rn tryrn flag = this.coreSendForAcptMatu(xmlstr,"009022","11111111111",Long.valueOf(1111111));rn// rcoreBean009022 = (RCoreBean009022)XmlParserToObject.parserXML(responseXml.substring(10, responseXml.length()), rcoreBean009022);rn long date2 = new Date().getTime();rn long haomiao =date2-date1; rn if("1".equals(flag))rn System.out.println("end:true");rn System.out.println("msg:"+getWay+"@true@"+haomiao); rn elsern System.out.println("end:false");rn System.out.println("msg:"+getWay+"@false@"+haomiao);rn rn rn catch (Exception e) rn long date2 = new Date().getTime();rn System.out.println(date2);rn long haomiao =date2-date1; rn System.out.println("end:false");rn System.out.println("msg:"+getWay+"@false@"+haomiao);rn rn rn rn public String coreSendForAcptMatu(String bodyXml,String iCode,String acct,Long acptBatchId )rn String str = "";rn try rn str = String .format("%010d", bodyXml.getBytes("GBK").length);rn String ip = "172.16.8.11";rn int port = 11017;rn str = this.sendAndReciveMsgForAcptMatu(ip,port,str+bodyXml,iCode,acct,acptBatchId);rn catch (UnsupportedEncodingException e) rn e.printStackTrace();rn rn return str;rn rn rn public String sendAndReciveMsgForAcptMatu(String ip, int port,String msg,String iCode,String acct,Long acptBatchId )rn String flag = "1";rn Connection conn=null;rn Statement stmt = null;rn Socket socket = new Socket();rn tryrn Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();rn String url="jdbc:oracle:thin:@172.16.12.201:1521:date1211";rn String user = "test1";rn String password = "test1";rn conn = DriverManager.getConnection(url, user, password);rn String sendlog = "insert into core_or_payment_log (ID, CORE_CODE, REMARK, CORE_LOG, SEND_ID, CREATE_TIME, ACCT, ACPT_BATCH_ID) " +rn "values (hibernate_sequence.nextval,'009022','发出','"+msg+"','',''"+",'"+acct+"',"+acptBatchId+")";rnrn stmt = conn.createStatement();rn stmt.executeUpdate(sendlog);rn rn String respMsg = "";rn InetSocketAddress iAddress = new InetSocketAddress(ip, port);rn socket.connect(iAddress);rn if (socket.isConnected()) rn sendMsg(socket, msg);rn respMsg = reciveMsg(socket);rn if(null==respMsg||"".equals(respMsg))rn flag = "0";rn throw new Exception("异常!");rn rn respMsg = respMsg.replaceAll("'", "\"");rn String receivelog ="insert into core_or_payment_log (ID, CORE_CODE, REMARK, CORE_LOG, SEND_ID, CREATE_TIME, ACCT, ACPT_BATCH_ID) " +rn "values (hibernate_sequence.nextval,'009022','接收','"+respMsg+"','',''"+",'"+acct+"',"+acptBatchId+")";rn stmt.executeUpdate(receivelog);rn rn elsern flag = "0";rn rn catch (Exception e) rn System.out.println(e);rn flag = "0";rn finally rn close(socket);rn rn return flag;rn rn rn public static void sendMsg(Socket s, String msg) rn DataOutputStream bos = null;rn FileOutputStream fos = null;rn try rn byte[] buffer =null;rn try rn buffer = msg.getBytes("GBK");rn bos = new DataOutputStream(new BufferedOutputStream(s.getOutputStream()));rn bos.write(buffer);rn bos.flush();rn rn fos = new FileOutputStream("F:\\coreMsg.txt");rn DataOutputStream out = new DataOutputStream(fos);rn out.write(buffer);rn out.close();rn rn rn catch (Exception e) rn e.printStackTrace();rn rn catch (Exception e) rn e.printStackTrace();rn finallyrn if(fos!=null)rn try rn fos.close();rn catch (IOException e) rn e.printStackTrace();rn rn rn rn rn rn public static String reciveMsg(Socket socket) throws IOException rn String responsXml = "";rn try rn DataInputStream dis = new DataInputStream(new BufferedInputStream(socket.getInputStream())); rn byte[] bytes = null;rn byte[] header = new byte[10];rn int len;rn int msgLen = 0;rn if ((len = dis.read(header)) > 0) rn msgLen = Integer.parseInt(new String(header, "GBK"));rn bytes = new byte[header.length];rn System.arraycopy(header, 0, bytes, 0, header.length);rn elsern return "";rn rn byte[] b = new byte[msgLen];rn while ((len = dis.read(b)) != -1) rn byte[] tmp = new byte[bytes.length];rn System.arraycopy(bytes, 0, tmp, 0, bytes.length);rn bytes = new byte[bytes.length + len];rn System.arraycopy(tmp, 0, bytes, 0, tmp.length);rn System.arraycopy(b, 0, bytes, tmp.length, len);rn rn rn rn if (bytes != null) rn responsXml = new String(bytes,"GBK");rn else rn responsXml = "";rn rn catch (IOException e) rn e.printStackTrace();rn throw new RuntimeException("错误");rn rn return responsXml;rn rn public String getUUID(String code,String strCode,String strId,String iCode)rn String flowNo = ""; rn if(strId.length()>7)rn flowNo = strCode+strId.substring(strId.length()-7, strId.length());rn elsern flowNo = strCode+strId;rn rn String flowNoStrtemp="";rn for(int i = 0;i<8-flowNo.length();i++)rn flowNoStrtemp="0"+flowNoStrtemp;rn rn String flowNoStr = flowNoStrtemp+flowNo;rn String iCodeStr = String .format("%07d", iCode.length());rn String dt = "";rn SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");rn Calendar cal = Calendar.getInstance();rn dt = sdf.format(cal.getTime());rn return "G"+code+dt+flowNoStr+iCodeStr;rn rn public String getUserNoStr(String userNoStr)rn String flowNoStrtemp="";rn for(int i = 0;i<7-userNoStr.length();i++)rn flowNoStrtemp="0"+flowNoStrtemp;rn rn userNoStr = flowNoStrtemp+userNoStr;rn return userNoStr;rn rn public static void close(Socket s) rn try rn if (s != null) s.close();rn catch (IOException e) rn e.printStackTrace();rn rn rn rn public static void main(String[] args) rn Hello hh = new Hello();rn hh.core009022();rn rnrn[/code]
一个编译问题vc6编译通过vs20xx编译不过问题
1>test.cpprn1>c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(510) : error C2664: “clearerr_s”: 不能将参数 1 从“FCGI_FILE *”转换为“FILE *”rn1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换rnrnrnvc中的声明rninline void __cdecl Afx_clearerr_s(FILE *stream)rnrn AFX_CRT_ERRORCHECK(::clearerr_s(stream));rnrnrnrn以下是FCGI_FILE声明rntypedef struct rn FILE *stdio_stream;rn FCGX_Stream *fcgx_stream;rn FCGI_FILE;rnrnrn编译的时候有没有调试时堆栈那种东西?我想知道是什么地方调到这个Afx_clearerr_s,另外我没有使用mfc
奇怪!!程序在DEBUG和RELEASE下都可以编译通过,但是
RELEASE下可以正常运行,DEBUG下却提示XX内存不能写……rnrn急啊!
Phone Release 可以编译通过 emulator 报错
小弟接手了一个学长的项目,有一个关于发请求给服务器,返回当前经纬度的模块(该模块比较大,不方便贴出来),结果我用Phone Release可以通过,emulator不能通过,报错是undefined identifier ****,希望能给点意见,谢谢。
Release编译通过,执行有问题
debug版本编译执行都没有问题rnrelease版本编译没问题,执行的时候在main退出的时候有问题rnmain中定义的对象析构函数也调用了rn有可能是哪儿的问题呢?rn
我在VC6下顺利编译通过的程序为什么在.net下就不可以了
很简单地我自定义一个消息rn#define WM_NOTIFYICON (WM_USER + 1)rn然后在.cpp中rnBEGIN_MESSAGE_MAP(CWinToolsDlg, CDialog)rn rn //AFX_MSG_MAPrnON_MESSAGE(WM_NOTIFYICON,OnNotifyIcon)rnEND_MESSAGE_MAP()rnrn在.h中rn afx_msg void OnNotifyIcon(WPARAM wParam,LPARAM lParam);rn DECLARE_MESSAGE_MAP()rn还有就是函数体,省略rn编译时报错:rnEND_MESSAGE_MAP()WinToolsDlg.cpp(69) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CWinToolsDlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'rn谁用.net试验一下自定义消息?rn
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件

相似问题

1
vc++6.0使用mfc创建一个windows窗口没报错但不能运行
2
VS2013上MFC界面,编译成功,运行报错!!!求教
2
MFC单文档程序运行过程中崩溃无响应?
1
VS2010 编译C++程序 如何取消函数间的0xCC填充
1
vs编译生成的程序,程序运行比vc生成的程序,运行时间慢
2
VS2017怎么重置所有VC++库目录等配置
1
VC++6.0在CXXXView的构造函数中用了GetDC(),不报错,但运行之后提示错误
0
VS2015下stlport编译时error:无法打开包括文件"../include/ctype.h"?
2
这个程序哪里出问题了?为什么运行结果没出来?编译和构建都没有问题啊。
1
如何将VS2008的工程移植到Qt creator上? Qt creator项目调用MFC的lib库时报错,求解决?
1
在VC++6.0中构建CDib类,但是编译之后出现错误:无法找到CDib.h文件,请问如何解决?
1
Anaconda navigator打开的时候没有反应?更新的时候报错
0
关于visual studio构建FTP服务端打开文件程序出现断点的情况
3
VS2013打开的控制台窗口关不掉是什么原因?
0
conda安装librosa报错LinkError: post-link script failed for package conda-forge::qt?
2
VS2008 C# winform 64位程序动态调用VC++ 64位DLL LoadLibrary成功 但是GetProcAddress返回值为0
0
__outpw函数在VC 64位平台编译提示找不到标识符
1
求此题的完整的程序设计,一定要完整!能在VC++6.0上运行。
1
求解不用VC运行程序后出现断言失败的问题
2
汇编程序无法通过调试,忘前辈多多指导