Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a program with libpqxx, getting error: The application was unable to start correctly (0xc000007b). Click OK to close the application. #20

Closed
aw18 opened this issue Jun 25, 2017 · 2 comments

Comments

@aw18
Copy link

aw18 commented Jun 25, 2017

I was able to successfully build the Static library for libpqxx using the command:
nmake /f win32/vc-libpqxx.mak STATIC
on the Developer Command Prompt for VS2013.

I then copied and paste one of the sample programs, such as below:

#include "stdafx.h"
#include
#include <pqxx/pqxx>

using namespace std;
using namespace pqxx;

int main(int argc, char *argv[])
{
try {
connection C("dbname = test user = postgres password = rcm
hostaddr = 127.0.0.1 port = 5434");
/if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
}
else {
cout << "Can't open database" << endl;
return 1;
}
C.disconnect();
/
}
catch (const std::exception &e) {
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

Successfully compiled but when I run the executable, I get a pop-up error that states:
The application was unable to start correctly (0xc000007b). Click OK to close the application.

Searching online, it seems to be due to a 32-bit application calling a 64-bit DLL issue. I've used Dependency Walker (but people online states it's too old and isn't accurate, i.e. 2006) and I've used ProcessMonitor but nothing stands out.

Any advice?

@aw18
Copy link
Author

aw18 commented Jun 25, 2017

Okay I resolved it using ProcessMonitor.

My PATH env variable was including the MinGW's libpq.dll. So all I had to do was remove all instances of MinGW reference in my PATH and it works!

@jtv
Copy link
Owner

jtv commented Jul 3, 2017

Use static libraries if you can... :/

@jtv jtv closed this as completed Sep 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants