ich erfolgreich gebaut und installiert POCO C++ mit diesen Schritten: https://pocoproject.org/docs/00200-GettingStarted.htmlPoco C++ Verknüpfung Fehler: undefined reference to `Poco :: Data :: MySQL :: Stecker :: registerConnector()
lief ich die folgenden Befehle während Build :
sudo apt-get install openssl libssl-dev
sudo apt-get install libiodbc2 libiodbc2-dev
Installed Mysql client
gunzip poco-X.Y.tar.gz
tar -xf poco-X.Y.tar
cd poco-X.Y
./configure
make -s -j4
Der Build war erfolgreich.
Für die Installation:
./configure --prefix==/usr/local/poco2/
sudo make -s install
Mein testy.cpp
Code:
#include "iostream.h"
#include "Poco/Data/MySQL/MySQLException.h"
#include "Poco/Data/MySQL/MySQL.h"
#include "Poco/Data/MySQL/Connector.h"
#include "Poco/Data/SessionFactory.h"
using namespace Poco::Data;
int main() {
MySQL::Connector::registerConnector();
return 0;
}
Mein Fehler ist:
/tmp/ccvlAI5T.o: In function `main':
testy.cpp:(.text+0x5): undefined reference to `Poco::Data::MySQL::Connector::registerConnector()'
collect2: error: ld returned 1 exit status
Include Pfade:
-I/home/saurabh/project2/poco-1.7.9-all/Data/MySQL/include/
-I/usr/local/poco2/include/
-I/usr/include
Verknüpfte Pfade:
-L/usr/local/poco2/lib/
-L/home/saurabh/project2/poco-1.7.9-all/lib/Linux/x86_64
-L/usr/lib -lmysqlclient
Die Kompilierung und Ausführungsbefehl auf Ubuntu Linux ist:
g++ -o testy testy.cpp -I/home/saurabh/project2/poco-1.7.9-all/Data/MySQL /include/ -I/usr/local/poco2/include/ -I/usr/include -L/usr/local/poco2 /lib -L/home/saurabh/project2/poco-1.7.9-all/lib/Linux/x86_64 -L/usr/lib -lmysqlclient
Hallo Danke, es kompiliert und verknüpft –
In diesem Fall können Sie meine Antwort akzeptieren? Vielen Dank. – Patricklaf