我写了C 程序,以与代码块中的PostgreSQL数据库连接,并且没有编译错误,但它显示(0xc0000005(运行时间错误。我使用MINGW Compiler的代码块IDE IDE。库文件仍然连接,仍然没有执行连接函数。如果有人可以提供帮助,该如何解决?
#include <iostream>
#include <SQLAPI.h> // main SQLAPI++ header
using namespace std;
int main(int argc, char* argv[])
{
// create connection object to connect to database
SAConnection con;
cout<<"connecting..n";
它正在打印此"连接"单词,如果我要在尝试部分中打印一些东西,那么它也在打印,而不是在连接函数之后。
try {
// connect to database
// in this example, it is Oracle,
// but can also be Sybase, Informix, DB2
// SQLServer, InterBase, SQLBase and ODBC
//Calling connect function through object of connection class and passing parameters to it.
con.Connect("99999", // database name
"postgres", // user name
"9874159891974", // password
SA_PostgreSQL_Client); //postgresql Client
cout<< "We are connected!n";
con.Disconnect(); // this is optional
cout << "We are disconnected!n";
}
catch(SAException & x)
{ // SAConnection::Rollback()
// can also throw an exception
// (if a network error for example),
// we will be ready
cout<<"something went wrong"; // print error message
}
return 0 ;
}
我希望我的代码没有错误,当我构建程序时,没有汇编错误,也没有显示的警告。
错误:
连接.. 流程返回-1073741819(0xc0000005(执行时间:2.251 s 按任何键继续。
*****调试器*******
设置断点调试器名称和版本:GNU GDB(GDB(7.9.1儿童过程PID:332程序收到信号sigsegv,分段故障。在sastring :: init(this = 0x4b9032(
它是beacuse password lenght或因为OS音响系统。wtf?是的!查看:https://www.google.com/search?ie=utf-8&; q =%22-1073741819"
编辑1:在" csc.exe"中由代码-1073741819退出,此答案:
'(...(,我的问题是...我有病毒/恶意软件问题,错误的模块是bitguard!
因此,如果有人遇到了这个问题,然后在这里搜索解决方案,我认为您必须尝试任何免费的恶意软件拆卸程序,以查看Bitguard是否不应该是您的问题!(...(&quot;
和此:
当我们公司更改反病毒软件时,几个月来未触摸的应用程序突然开始患有"构建错误" csc.exe&quot'带有代码-532462766 ..
退出我使用我们的新AV客户端来扫描无法构建的应用程序的bin文件夹。AV客户声称它被W32.trojan.genkd感染。卸载该AV软件允许它照常构建。我认为一个文件被隔离,阻止了构建。
您的选项可能是:
对文件进行消毒(假设它是实际的感染(毫无疑问"感染"文件(假设它实际上是安全的(卸载/禁用AV客户更改AV软件
证明问题可能出现在s.o中!否则,您可以尝试删除垃圾箱和OBJ文件夹,然后清洁和重建项目。
要调试,在项目属性中的Canmark部署数据库。