我目前正在嘗試使用C++創建Firebird數據庫。 Firebird安裝在我的電腦上。 我的程序如下所示:使用IBPP使用C++創建Firebird數據庫
#define IBPP_WINDOWS = true
#define IBPP_GCC = true
#include "ibpp.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <sstream>
#include <cmath>
using namespace std;
using std::vector;
using std::string;
using std::ifstream;
using std::ofstream;
using std::getline;
using std::cin;
using std::cout;
using std::endl;
using std::istringstream;
int main(int argc, char *argv[])
{
std::string UserName = "SYSDBA";
std::string Password = "**********";
std::string ServerName = "localhost";
char* DbName = (char *)"C:/Users/**********/Desktop/**********.fdb";
IBPP::Database db = IBPP::DatabaseFactory(ServerName,DbName,UserName,Password);
db->Create();
db->Connect();
}
當我嘗試編譯我的代碼,我得到以下信息:
C:\Users**********\AppData\Local\Temp\cc2Zhdj3.o:**********.cpp:(.text$_ZN4IBPP15DatabaseFactoryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_S7_S7_[__ZN4IBPP15DatabaseFactoryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_S7_S7_]+0xaa): undefined reference to `IBPP::DatabaseFactory(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)' collect2.exe: error: ld returned 1 exit status
有沒有人有一個想法,我做錯了什麼?
[你很可能沒有將適當的庫鏈接到你的應用程序。](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-和如何-DO-修復)。 – WhozCraig