Hibernate3中重复引用hbm文件错误信息记录

Hibernate3中重复引用hbm文件错误信息记录。

2018 八月 12 11:17:09,778 ERROR  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘loginManager‘ defined in ServletContext resource [/WEB-INF/applicationContext_sys.xml]: Cannot resolve reference to bean ‘baseDao‘ while setting bean property ‘dao‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘baseDao‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Cannot resolve reference to bean ‘sessionFactory‘ while setting bean property ‘sessionFactory‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:315)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1243)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1011)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:485)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at com.common.SysContextLoaderListener.contextInitialized(SysContextLoaderListener.java:14)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘baseDao‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Cannot resolve reference to bean ‘sessionFactory‘ while setting bean property ‘sessionFactory‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:315)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1243)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1011)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:309)
    ... 31 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:309)
    ... 43 more
Caused by: org.hibernate.InvalidMappingException: Could not p八月 12, 2018 11:17:09 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class com.common.SysContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘loginManager‘ defined in ServletContext resource [/WEB-INF/applicationContext_sys.xml]: Cannot resolve reference to bean ‘baseDao‘ while setting bean property ‘dao‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘baseDao‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Cannot resolve reference to bean ‘sessionFactory‘ while setting bean property ‘sessionFactory‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:315)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1243)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1011)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:485)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at com.common.SysContextLoaderListener.contextInitialized(SysContextLoaderListener.java:14)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘baseDao‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Cannot resolve reference to bean ‘sessionFactory‘ while setting bean property ‘sessionFactory‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:315)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1243)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1011)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:309)
    ... 31 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in ServletContext resource [/WEB-INF/applicationContext_base.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)
    at org.springframework.beans.factory.support.BeanDefinitionValueResol
arse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1491)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:597)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
    ... 52 more
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.pub.file.model.PubFileStore
    at org.hibernate.cfg.Mappings.addClass(Mappings.java:141)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:167)
    at org.hibernate.cfg.Configuration.add(Configuration.java:716)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
    ... 61 more
ver.resolveReference(BeanDefinitionValueResolver.java:309)
    ... 43 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pub/file/model/PubFileStore.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1491)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:597)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
    ... 52 more
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.pub.file.model.PubFileStore
    at org.hibernate.cfg.Mappings.addClass(Mappings.java:141)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:167)
    at org.hibernate.cfg.Configuration.add(Configuration.java:716)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
    ... 61 more

原文地址:https://www.cnblogs.com/xusweeter/p/9462375.html

时间: 2024-10-07 05:29:41

Hibernate3中重复引用hbm文件错误信息记录的相关文章

如何去掉[email protected]中的@符号Linux文件扩展信息

如何去掉[email protected]中的@符号Linux文件扩展信息ls -lart [email protected] 10 rlanffy staff 340B 3 6 2015 [email protected] 1 rlanffy staff 630B 6 10 17:22 [email protected] 1 rlanffy staff 4.8K 8 12 14:17 [email protected] 3 rlanffy staff 102B 8 14 12:10 [emai

Hibernate3的hbm文件错误引用dtd文件导致项目无法启动问题处理

错误信息: org.hibernate.InvalidMappingException: Could not parse mapping document from resource /***/****.hbm.xml 项目无法正常启动,经确认该hibernate映射文件存在. 问题解决: 该hibernate映射文件反向生成时头部引用的dtd文件为"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd",而原有能正常运行的dtd

转 mvc项目中,解决引用jquery文件后智能提示失效的办法

mvc项目中,解决用Url.Content方法引用jquery文件后智能提示失效的办法 这个标题不知道要怎么写才好, 但是希望文章的内容对大家有帮助. 场景如下: 我们在用开发开发程序的时候,经常会引用jquery, 但是由于路由的关系,最终访问页面的地址相对js文件来说,是不固定的. 为了在view中能够引用到jquery文件,我们通常都是用如下的代码 <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")

存储过程,捕获错误信息记录到日志文件中

USE [erpdb1]GO/****** Object:  StoredProcedure [dbo].[sp_WriteFileMy]    Script Date: 12/26/2014 15:00:46 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO--创建存储过程ALTER procedure  [dbo].[sp_WriteFileMy] @msg nvarchar(300)  as  begin DECLARE @cmd s

关于Android的hellowrd中出现的r文件错误

当你的androidAPI 由2.1版本更换成2.2版本时:res/vavlues/styles.xml中使用的android:WindowTitle会报以下异常,error: Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitle'.从而导致我们的程序无法编译通过. 解决办法:右键appcompat_v7或项目,选properties——androi

HTTP协议中常用状态码和含义,以及错误信息提示

转自:https://www.cnblogs.com/williamjie/p/9849996.html   https://www.cnblogs.com/omak/p/10211449.html HTTP协议状态码,是指在HTTP协议运作中由客户端发出请求连接,服务端建立连接,客户端发出HTTP请求,服务端返回响应信息,而在这个过程张由于客户端或服务端的问题会返回相应的错误代码并显示给用户,对应的错误代码表示不同的错误信息,根据这个信息用户可以调整相应的操作来修改出现的错误,最终避免错误的再

在ASP.NET 5中显示错误信息

在 ASP.NET 5 中如果不进行显示错误信息的相关配置,在发生错误时,在浏览器中只能看到空白页面. 显示错误信息的配置方法如下: 1)在 project.json 中添加对 Microsoft.AspNet.Diagnostics 的引用 { "dependencies":{ "Microsoft.AspNet.Diagnostics": "1.0.0-*" } } 2)在 Startup.cs 中添加 app.UseErrorPage()

php 错误信息配置

错误回显,一般常用语开发模式,但是很多应用在正式环境中也忘记了关闭此选项.错误回显可以暴露出非常多的敏感信息,为攻击者下一步攻击提供便利.推荐关闭此选项 display_errors 错误回显,一般常用语开发模式,但是很多应用在正式环境中也忘记了关闭此选项.错误回显可以暴露出非常多的敏感信息,为攻击者下一步攻击提供便利.推荐关闭此选项. display_errors = On 开启状态下,若出现错误,则报错,出现错误提示 dispaly_errors = Off 关闭状态下,若出现错误,则提示:

C++中无法解析的外部符号错误

? 在编译C++程序的时候,如果引用了对应的头文件,但是调用一个函数的时候仍然出现" 无法解析的外部符号错误"的编译错误,比如: 无法解析的外部符号[email protected],该符号在函数 _main 中被引用 ? 那是因为在项目中没有引用.lib文件. 有两种方式解决此问题: 在项目属性->编译器->输入->附加依赖项 中加入.lib文件. ? 代码头部引入.lib文件,比如: #pragma?comment(lib,?"shlwapi"