My program has a basic function for adding datas to database but when the code gives an error when it is compiled.
void MainWindow::AddLocationToDatabase()
{
QSqlDatabase db= QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setUserName("root");
db.setPassword("*******");
db.setDatabaseName("databasename");
db.setPort(1111);
if(db.open()){
qDebug()<<"connected";
}
}
/usr/bin/ld: build/debug/mainwindow.o: undefined reference to symbol '_ZN12QSqlDatabase11setHostNameERK7QString'
/usr/lib/x86_64-linux-gnu/libQt5Sql.so.5: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sub-pcapprogram-make_first-ordered] Error 2
06:57:04: The process "/usr/bin/make" exited with code 2.
When executing step "Make"
When I added "QT += sql", there was no error.
Related
I'm trying to compile C code generated from Python code (hello world) and I'm stuck on one error.
I'm using mingw32-w64. After many errors now I'm using this command
gcc -DMS_WIN64 -I Python38\include -o test.exe test.c -lpython38 -lm -L Python38\libs -shared -Wl,--enable-auto-image-base -Wl,--enable-auto-import
But I'm getting error
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x28c): undefined reference to `__imp_PyExc_ImportError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x307): undefined reference to `__imp__Py_NoneStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x34c): undefined reference to `__imp_PyExc_AttributeError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x59c): undefined reference to `__imp_PyExc_RuntimeError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xb51): undefined reference to `__imp_PyExc_ImportError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xc23): undefined reference to `__imp_PyExc_NameError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xcb9): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd22): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd32): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd40): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd8a): undefined reference to `__imp_PyExc_SystemError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xfc4): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xfcd): undefined reference to `__imp__Py_TrueStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x101f): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1037): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1044): undefined reference to `__imp__Py_TrueStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x17c0): undefined reference to `__imp_PyModule_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x17d8): undefined reference to `__imp_PyModule_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x18d4): undefined reference to `__imp_PyBaseObject_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1e92): undefined reference to `__imp_PyExc_DeprecationWarning'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1ee9): undefined reference to `__imp_PyExc_TypeError'
c:/users/ja/documents/winbuilds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
Using Python 3.8.4 x86_64-w64-mingw32 Windows 10
I am getting the following exception while building the recovery for a lineageos project and need some help diagnosing and resolving the issue
Device tree:= https://github.com/darran-kelinske-fivestars/android_device_lenovo_tb8504f/tree/lineage-15.1
Vendor tree:= https://github.com/darran-kelinske-fivestars/android_vendor_lenovo_tb8504f/tree/lineage-15.1
Kernel source:= https://github.com/darran-kelinske-fivestars/android_kernel_lenovo_tb8504f/tree/lineage-15.1
ROM Source:= https://github.com/LineageOS/android
Command: source build/envsetup.sh && breakfast tb8504f && repo sync --force-sync -q -j6 && mka recoveryimage -j6 | tee recovery.log
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c: In function 'ebt_standard_compat_from_user':
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:61:3: error: implicit declaration of function 'xt_compat_calc_jump' [-Werror=implicit-function-declaration]
v += xt_compat_calc_jump(NFPROTO_BRIDGE, v);
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c: At top level:
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:76:15: error: variable 'ebt_standard_target' has initializer but incomplete type
static struct xt_target ebt_standard_target = {
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:77:2: error: unknown field 'name' specified in initializer
.name = "standard",
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:77:2: warning: excess elements in struct initializer
error, forbidden warning: ebtables.c:77
CC net/core/gen_estimator.o
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:257: recipe for target 'net/bridge/netfilter/ebtables.o' failed
make[4]: *** [net/bridge/netfilter/ebtables.o] Error 1
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:402: recipe for target 'net/bridge/netfilter' failed
make[3]: *** [net/bridge/netfilter] Error 2
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:402: recipe for target 'net/bridge' failed
make[2]: *** [net/bridge] Error 2
make[2]: *** Waiting for unfinished jobs....
Full log:
https://pastebin.com/v2ZsfRuc
I resolved this issue by replacing the source in the include directory of this project with the include directory of another project.
I replaced the source with the source from this directory:
https://github.com/HighwayStar/android_kernel_lenovo_tb8704/tree/tab4-8plus-LA.UM.5.6.r1-0/include
I'm trying to make "RESTful" using CodeIgniter 3.1.5 and libraries https://github.com/chriskacerguis/codeigniter-restserver
I get this error:
Fatal error: Call to undefined factory function () in D:\AppServ\www\restful\application\libraries\REST_Controller.php on line 857
A PHP Error was encountered
Severity: Error
Message: Call to undefined function factory ()
Filename: libraries/REST_Controller.php
Line Number: 857
Backtrace:
(Not my code, but it is example from codeigniter-restserver)
enter in line 61 of autoload.php
$autoload['libraries'] = array('database','Format');
I solved it that way.
I am trying to install caffe, but I got the following error. Exist solution does not work.
System info:
echo $LD_LIBRARY_PATH
/lib/x86_64-linux-gnu:
Error:
//usr/lib/x86_64-linux-gnu/libunwind.so.8: undefined reference to `lzma_index_end#XZ_5.0'
//usr/lib/x86_64-linux-gnu/libunwind.so.8: undefined reference to `lzma_index_size#XZ_5.0'
//usr/lib/x86_64-linux-gnu/libunwind.so.8: undefined reference to `lzma_index_buffer_decode#XZ_5.0'
//usr/lib/x86_64-linux-gnu/libunwind.so.8: undefined reference to `lzma_stream_footer_decode#XZ_5.0'
//usr/lib/x86_64-linux-gnu/libunwind.so.8: undefined reference to `lzma_stream_buffer_decode#XZ_5.0'
//usr/lib/x86_64-linux-gnu/libunwind.so.8: undefined reference to `lzma_index_uncompressed_size#XZ_5.0'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/finetune_net.dir/build.make:133: recipe for target 'tools/finetune_net' failed
make[2]: *** [tools/finetune_net] Error 1
CMakeFiles/Makefile2:435: recipe for target 'tools/CMakeFiles/finetune_net.dir/all' failed
make[1]: *** [tools/CMakeFiles/finetune_net.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
I am trying to compile MySQL++ 3.1.0 with the command:
mingw32-make -f Makefile.mingw
After a set of files gets compiled (e.g. beemutex.cpp, cmdline.cpp, connection.cpp, ...), I get these errors:
g++ -c -o mysqlpp_sql_buffer.o -g -mthreads -DUNICODE -D_UNICODE -DMYSQLPP_NO_DLL -DHAVE_MYSQL_SSL_SET -I"C:\Program Files\MySQL\MySQL Server 5.5\include" -MT
mysqlpp_sql_buffer.o -MFmysqlpp_sql_buffer.o.d -MD -MP lib/sql_buffer.cpp
In file included from lib/sql_buffer.h:31:0,
from lib/sql_buffer.cpp:26:
lib/refcounted.h:258:2: error: 'size_t' does not name a type
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer()':
lib/refcounted.h:89:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(T*)':
lib/refcounted.h:100:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h:104:4: error: 'refs_' was not declared in this scope
lib/refcounted.h:104:16: error: expected type-specifier before 'size_t'
lib/refcounted.h:104:16: error: expected ';' before 'size_t'
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(const ThisType&)':
lib/refcounted.h:112:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h:115:8: error: 'refs_' was not declared in this scope
lib/refcounted.h: In destructor 'mysqlpp::RefCountedPointer<T, Destroyer>::~RefCountedPointer()':
lib/refcounted.h:125:7: error: 'refs_' was not declared in this scope
lib/refcounted.h: In member function 'void mysqlpp::RefCountedPointer<T, Destroyer>::swap(mysqlpp::RefCountedPointer<T, Destroyer>::ThisType&)':
lib/refcounted.h:246:13: error: 'refs_' was not declared in this scope
mingw32-make: *** [mysqlpp_sql_buffer.o] Error 1
Something could be wrong in my configuration, but I can't find what. It seems strange that it cannot find, e.g., size_t.
Thank you!
Platform:
Windows 7
MinGW 2011.09 / GCC 4.6.1
MySQL 5.5
mysql++ 3.1.0
Changing size_t() with std::size_t() in refcounted.h solved the problem. It now compiles.
I still have linking problems, but they should be different issues.