1>MySqlConn.obj : error LNK2001: 无法解析的外部符号 _mysql_real_connect@32

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1>MySqlConn.obj : error LNK2001: 无法解析的外部符号 _mysql_real_connect@32相关的知识,希望对你有一定的参考价值。

1>mysqlConn.obj : error LNK2001: 无法解析的外部符号 _mysql_init@4
#include "stdafx.h"
#include <winsock.h>
#include <iostream>
#include <string>
#include "mysql.h"

#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "libmysql.lib")

using namespace std;
int _tmain(int argc, _TCHAR* argv[])

//必备的一个数据结构
MYSQL mydata;
char * host ="127.0.0.1";
char * user="root";
char * passwd = "root";
char * Db = "socket";
char * Msg = "";

if (mysql_init(&mydata)==NULL)

Msg = "Inital mysql handle error";
return 1;


if (mysql_real_connect(&mydata,host,user,passwd,Db,0,NULL,0) == NULL)

Msg = "Failed to connect to database:Error";
return 1;


return 0;

这句话的意思就是找不到mysql_init这个函数在哪定义。

请给出"mysql.h"的内容,和实现它的那个c/cpp源代码,函数定义的具体内容不需要给出,重点对照你声明和定义时的函数名和函数参数、返回值有没写错。
参考技术A 不晓得 不晓得 飘过 参考技术B 若编译64位的程序,要对应64位的MYSQL,否则编译出错。若现在安装了64位的MYSQL,要编译32位的程序,则重新安装32bit的MySQL即可。

text Erro depois de fazer o没有部署heroku

2018-03-24T18:47:13.586817+00:00 app[web.1]: 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
2018-03-24T18:47:13.586819+00:00 app[web.1]: 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
2018-03-24T18:47:13.586820+00:00 app[web.1]: 	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
2018-03-24T18:47:13.586824+00:00 app[web.1]: 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
2018-03-24T18:47:13.586822+00:00 app[web.1]: 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
2018-03-24T18:47:13.586825+00:00 app[web.1]: 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
2018-03-24T18:47:13.586827+00:00 app[web.1]: 	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
2018-03-24T18:47:13.586830+00:00 app[web.1]: 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
2018-03-24T18:47:13.586828+00:00 app[web.1]: 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
2018-03-24T18:47:13.586832+00:00 app[web.1]: 	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:815)
2018-03-24T18:47:13.586833+00:00 app[web.1]: 	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:721)
2018-03-24T18:47:13.586838+00:00 app[web.1]: Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NullPointerException
2018-03-24T18:47:13.586835+00:00 app[web.1]: 	... 24 more
2018-03-24T18:47:13.586840+00:00 app[web.1]: 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
2018-03-24T18:47:13.586841+00:00 app[web.1]: 	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
2018-03-24T18:47:13.586843+00:00 app[web.1]: 	... 37 more
2018-03-24T18:47:13.586844+00:00 app[web.1]: Caused by: java.lang.NullPointerException
2018-03-24T18:47:13.586846+00:00 app[web.1]: 	at br.com.casadocodigo.loja.conf.JpaProductionConfiguration.dataSource(JpaProductionConfiguration.java:32)
2018-03-24T18:47:13.586848+00:00 app[web.1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-03-24T18:47:13.586850+00:00 app[web.1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-03-24T18:47:13.586853+00:00 app[web.1]: 	at java.lang.reflect.Method.invoke(Method.java:498)
2018-03-24T18:47:13.586852+00:00 app[web.1]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-03-24T18:47:13.586855+00:00 app[web.1]: 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
2018-03-24T18:47:13.586856+00:00 app[web.1]: 	... 38 more
2018-03-24T18:47:13.586858+00:00 app[web.1]: 
2018-03-24T18:47:13.587496+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.core.StandardContext startInternal
2018-03-24T18:47:13.587499+00:00 app[web.1]: SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
2018-03-24T18:47:13.900120+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
2018-03-24T18:47:13.900132+00:00 app[web.1]: WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [303] milliseconds.
2018-03-24T18:47:13.909210+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.core.StandardContext startInternal
2018-03-24T18:47:13.909213+00:00 app[web.1]: SEVERE: Context [] startup failed due to previous errors
2018-03-24T18:47:13.912738+00:00 app[web.1]: SEVERE: Context [] failed in [org.apache.catalina.core.StandardContext] lifecycle. Allowing Tomcat to shutdown.
2018-03-24T18:47:13.928925+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.core.ApplicationContext log
2018-03-24T18:47:13.928928+00:00 app[web.1]: INFO: Closing Spring root WebApplicationContext
2018-03-24T18:47:13.971960+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
2018-03-24T18:47:13.971973+00:00 app[web.1]: WARNING: The web application [ROOT] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2018-03-24T18:47:13.972503+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
2018-03-24T18:47:13.972505+00:00 app[web.1]: WARNING: The web application [ROOT] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2018-03-24T18:47:13.987888+00:00 app[web.1]: Mar 24, 2018 6:47:13 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
2018-03-24T18:47:13.987897+00:00 app[web.1]: WARNING: The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
2018-03-24T18:47:13.987899+00:00 app[web.1]:  java.lang.Object.wait(Native Method)
2018-03-24T18:47:13.987901+00:00 app[web.1]:  java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
2018-03-24T18:47:13.987903+00:00 app[web.1]:  com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
2018-03-24T18:47:13.987905+00:00 app[web.1]:  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2018-03-24T18:47:13.987906+00:00 app[web.1]:  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2018-03-24T18:47:13.987908+00:00 app[web.1]:  java.lang.Thread.run(Thread.java:748)
2018-03-24T18:47:14.002260+00:00 app[web.1]: Mar 24, 2018 6:47:14 PM org.apache.coyote.AbstractProtocol start
2018-03-24T18:47:14.002264+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-4380"]
2018-03-24T18:47:14.641809+00:00 heroku[web.1]: Process exited with status 0
2018-03-24T18:47:14.660836+00:00 heroku[web.1]: State changed from up to crashed
2018-03-24T18:47:20.099295+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cdcaluracurso-igor.herokuapp.com request_id=bf65123a-7e2a-47ad-8931-dacc9d4bb84c fwd="143.0.21.145" dyno=web.1 connect=5002ms service= status=503 bytes= protocol=https
2018-03-24T18:47:21.482217+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cdcaluracurso-igor.herokuapp.com request_id=df835293-4c9e-4563-83d1-6ad2e26eb46e fwd="143.0.21.145" dyno= connect= service= status=503 bytes= protocol=https
2018-03-24T19:02:26.000000+00:00 app[api]: Build started by user igor.chagas.rodrigues@gmail.com
2018-03-24T19:02:50.916251+00:00 app[api]: Deploy 050b3432 by user igor.chagas.rodrigues@gmail.com
2018-03-24T19:02:50.916251+00:00 app[api]: Release v8 created by user igor.chagas.rodrigues@gmail.com
2018-03-24T19:02:51.392696+00:00 heroku[web.1]: State changed from crashed to starting
2018-03-24T19:02:26.000000+00:00 app[api]: Build succeeded
2018-03-24T19:02:57.695112+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar -Dspring.profiles.active=prod target/dependency/webapp-runner.jar --port 8992 target/*.war`
2018-03-24T19:03:00.611117+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-03-24T19:03:00.618751+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8 
2018-03-24T19:03:02.842283+00:00 app[web.1]: Expanding casadocodigo.war into /app/target/tomcat.8992/webapps/expanded
2018-03-24T19:03:02.842343+00:00 app[web.1]: Adding Context  for /app/target/tomcat.8992/webapps/expanded
2018-03-24T19:03:04.543015+00:00 app[web.1]: Mar 24, 2018 7:03:04 PM org.apache.coyote.AbstractProtocol init
2018-03-24T19:03:04.543036+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-8992"]
2018-03-24T19:03:04.633642+00:00 app[web.1]: Mar 24, 2018 7:03:04 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
2018-03-24T19:03:04.633646+00:00 app[web.1]: INFO: Using a shared selector for servlet write/read
2018-03-24T19:03:04.684456+00:00 app[web.1]: Mar 24, 2018 7:03:04 PM org.apache.catalina.core.StandardService startInternal
2018-03-24T19:03:04.684461+00:00 app[web.1]: INFO: Starting service [Tomcat]
2018-03-24T19:03:04.691627+00:00 app[web.1]: Mar 24, 2018 7:03:04 PM org.apache.catalina.core.StandardEngine startInternal
2018-03-24T19:03:04.691631+00:00 app[web.1]: INFO: Starting Servlet Engine: Apache Tomcat/8.5.29
2018-03-24T19:03:04.709488+00:00 heroku[web.1]: State changed from starting to up
2018-03-24T19:03:05.540244+00:00 app[web.1]: Mar 24, 2018 7:03:05 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
2018-03-24T19:03:05.540264+00:00 app[web.1]: INFO: No global web.xml found
2018-03-24T19:03:15.711065+00:00 app[web.1]: Mar 24, 2018 7:03:15 PM org.apache.jasper.servlet.TldScanner scanJars
2018-03-24T19:03:15.711078+00:00 app[web.1]: INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2018-03-24T19:03:16.218982+00:00 app[web.1]: Mar 24, 2018 7:03:16 PM org.apache.catalina.core.ApplicationContext log
2018-03-24T19:03:16.218994+00:00 app[web.1]: INFO: 2 Spring WebApplicationInitializers detected on classpath
2018-03-24T19:03:16.430619+00:00 app[web.1]: Mar 24, 2018 7:03:16 PM org.apache.catalina.core.ApplicationContext log
2018-03-24T19:03:16.430623+00:00 app[web.1]: INFO: Initializing Spring root WebApplicationContext
2018-03-24T19:03:16.433079+00:00 app[web.1]: log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
2018-03-24T19:03:16.433181+00:00 app[web.1]: log4j:WARN Please initialize the log4j system properly.
2018-03-24T19:03:16.433265+00:00 app[web.1]: log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2018-03-24T19:03:34.393363+00:00 app[web.1]: Hibernate: create table Produto (id  serial not null, dataLancamento timestamp, descricao varchar(255), paginas int4 not null, sumarioPath varchar(255), titulo varchar(255), primary key (id))
2018-03-24T19:03:35.069079+00:00 app[web.1]: Hibernate: create table Produto_precos (Produto_id int4 not null, tipo int4, valor numeric(19, 2))
2018-03-24T19:03:35.073155+00:00 app[web.1]: Hibernate: create table Role (nome varchar(255) not null, primary key (nome))
2018-03-24T19:03:35.476428+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=cdcaluracurso-igor.herokuapp.com request_id=503b7967-7cc3-499b-be69-4f6bcbf1f017 fwd="143.0.21.145" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2018-03-24T19:03:35.413307+00:00 app[web.1]: Hibernate: create table Usuario (username varchar(255) not null, nome varchar(255), password varchar(255), primary key (username))
2018-03-24T19:03:36.038900+00:00 app[web.1]: Hibernate: create table Usuario_Role (Usuario_username varchar(255) not null, roles_nome varchar(255) not null)
2018-03-24T19:03:36.387091+00:00 app[web.1]: Hibernate: alter table Usuario_Role drop constraint UK_jnmoadyberbn5oyaybe8dxskj
2018-03-24T19:03:36.395525+00:00 app[web.1]: Hibernate: alter table Usuario_Role add constraint UK_jnmoadyberbn5oyaybe8dxskj unique (roles_nome)
2018-03-24T19:03:36.710289+00:00 app[web.1]: Hibernate: alter table Produto_precos add constraint FK553k5h7a8cjy5qgjlavm0v5d9 foreign key (Produto_id) references Produto
2018-03-24T19:03:36.720393+00:00 app[web.1]: Hibernate: alter table Usuario_Role add constraint FKm7abqk7krlrd3bb61ecux2fnx foreign key (Usuario_username) references Usuario
2018-03-24T19:03:36.715127+00:00 app[web.1]: Hibernate: alter table Usuario_Role add constraint FK71ew4k231fswbu8x4lw6axoqm foreign key (roles_nome) references Role
2018-03-24T19:03:54.128301+00:00 app[web.1]: Mar 24, 2018 7:03:54 PM org.apache.catalina.core.ApplicationContext log
2018-03-24T19:03:54.128317+00:00 app[web.1]: INFO: Initializing Spring FrameworkServlet 'dispatcher'
2018-03-24T19:03:54.840821+00:00 app[web.1]: Mar 24, 2018 7:03:54 PM org.apache.coyote.AbstractProtocol start
2018-03-24T19:03:54.840843+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-8992"]
2018-03-24T19:03:55.571399+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=cdcaluracurso-igor.herokuapp.com request_id=5b34227e-2384-462f-8e03-410bb915a816 fwd="143.0.21.145" dyno=web.1 connect=0ms service=18712ms status=302 bytes=331 protocol=https
2018-03-24T19:04:00.559502+00:00 app[web.1]: Hibernate: select distinct produto0_.id as id1_0_, produto0_.dataLancamento as dataLanc2_0_, produto0_.descricao as descrica3_0_, produto0_.paginas as paginas4_0_, produto0_.sumarioPath as sumarioP5_0_, produto0_.titulo as titulo6_0_, precos1_.Produto_id as Produto_1_1_0__, precos1_.tipo as tipo2_1_0__, precos1_.valor as valor3_1_0__ from Produto produto0_ inner join Produto_precos precos1_ on produto0_.id=precos1_.Produto_id
2018-03-24T19:04:06.713677+00:00 heroku[router]: at=info method=GET path="/login" host=cdcaluracurso-igor.herokuapp.com request_id=4044ab1f-abc8-44f7-b921-6f78d4c99978 fwd="143.0.21.145" dyno=web.1 connect=1ms service=10846ms status=200 bytes=1424 protocol=http

以上是关于1>MySqlConn.obj : error LNK2001: 无法解析的外部符号 _mysql_real_connect@32的主要内容,如果未能解决你的问题,请参考以下文章

函数表达式

Centos7 install python-rrdtoll-1.47 erro

yum install报错“Transaction check erro"

C++ 指针引用

ubuntu 出现pcie bus erro

text BABEL - erro