Good afternoon all,
I'm trying to develop my first Qt application. I'm getting many errors like the following if I try to link in static libraries with my own code:
H:/NetBeansProjects/CommonLib/aes.cpp:607: undefined reference to `__gxx_personality_sj0'
H:/NetBeansProjects/CommonLib/aes.cpp:607: undefined reference to `_Unwind_SjLj_Register'
H:/NetBeansProjects/CommonLib/aes.cpp:615: undefined reference to `_Unwind_SjLj_Resume'
My code compiles and works when not used with Qt.
The Qt program compiled and worked before I tried to link my libraries.
Google-ing it shows it may be a mismatch between compilers used to build the two sets of code. I set the Netbeans environment to use the same tool chain to build both with no
change.
I'm using Windows, NetBeans 6.9.1, and the latest Qt. I've set the compiler to use
the Qt supplied mingw compiler.
Any suggestions?
Found the solution!
It was linking in libraries from previous versions of my projects.
I installed a new version of Mingw compiler with Qt to fix an issue. I set up the new compiler as a toolchain with a different name in Netbeans.
I did a clean and build on the referenced projects using the new tool chain. Netbeans stored the compiled library in a directory named from the tool chain. It left the old version of the library in another directory named for the original tool chain.
When you add a project reference to a library Netbeans imports the path to the library. If you change the tool chain (and therefore change the path to the library) other projects still point to the old code. You have to remove the project references and re-add them.
Related
I'm writing a project in VS 2017 that utilizes the Windows 32 bit version of SWI Prolog. I'm using the SWI Prolog C++ interface in another project that compiles with MSVC, using a C++ header and a .a static library to go with it.
I got everything linked together fine so that the projects runs okay in the local debugger mode for VS. However, when I try to use the compiled .exe, I get a linker error:
The procedure entry point __divmoddi4 could not be located in the dynamic link library C:\ProgrammingLanguages\swipl-32\bin\libswipl.dll
After some Googling I saw that this function is unique to newer versions of GCC, and it makes sense that the SWI Prolog library uses it considering it was cross compiled using MinGW.
The problem is I need this executable to work on its own, but I have no idea how to get the project to resolve this linker error without straight up switching to GCC. Is there any way I can resolve this linking error while still using MSVC?
I read some other threads about using extern "C" to resolve the problem but I get compiler errors since there's overloaded functions in the header I'm using. Unless I need to use the C header for SWI Prolog instead?
It seems that it tries to use different DLL versions in debugger and as a standalone EXE. Run the project in the debugger and check which DLLs it loads (there is a special pane somewhere in VS). Then make sure it can find the same DLLs when you run it as a standalone executable (e.g. put them in the same folder as the EXE).
Never found a true solution to this, but just an old way around. I rolled back SWI Prolog and grabbed an older version that actually had the static libraries built and available for Windows.
I'm very new to use Github libraries and it's not clear to me how to use the libtom library (https://github.com/libtom/libtomcrypt) in my Eclipse project. I have read that it is necesary to compile the library and then link that compiled in the project, how should i do that?
The library says that it is modular and that made me think that i only had to paste it into the project to work (I have a couple of libraries that were only necessary to paste them into the project and they worked) but I think this library is not so since it always sends this error:
C:\TP_CPP/Src/EncryptFunctions.cpp:73: undefined reference to `rijndael_ecb_decrypt'
I'm trying to compile a personal program that uses the Boost/Regex library in Orwell Dev-C++ with TDM-GCC 4.8.2 64 bit Release, and when I attempt to initialize a Boost::Regex object I get these error messages.
text$_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE[_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE]+0x2b): undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'
regex_tester_main.cpp:(.text$_ZN5boost9re_detail11raw_storage6extendEy[_ZN5boost9re_detail11raw_storage6extendEy]+0x5f): undefined reference to `boost::re_detail::raw_storage::resize(unsigned long long)'
regex_tester_main.o: bad reloc address 0x5f in section `.text$_ZN5boost9re_detail11raw_storage6extendEy[_ZN5boost9re_detail11raw_storage6extendEy]'
I've followed this guide to install Boost and I used gcc as my toolkit parameters for the bootstrap.bat and the b2 builder. I've included the include and lib paths in my includes and library options. And lastly linked the appropriate libboost_regex*.a file. Before this I tried using the mingw toolkit option for the bootstrap and gcc option for b2 like the tutorial linked above does, and encountered the same errors. Can anyone shed insight into what has gone wrong?
SOLVED!
I also have the Haskell GHC installed which comes packaged with a mingw/GCC package which was located earlier in the PATH environment variable than the TDM-GCC/minGW-64 package I was aiming to use to build Boost. And so when I specified my toolset it was targeting the wrong complier and thus when I tried to build other programs with Boost it probably ran into some name-mangling issues. I removed GHC's mingw/GCC complier package from PATH and rebuilt Boost, it complies and links fine now :).
I am using libzbarQT (libzbarQT.so) in my QT code.I am facing an error while building the code saying "undefined reference to QWidget::qwsEvent(QWSEvent *event)".I am not using this function in my QT code.I want to know which function is internally calling this function so that I can tweak the library a bit.
Any suggestions please..
Thanks in advance for any help.
PS: I am crosscompiling my code using arm-none-linux-gnueabi-g++ toolchain with LTIB.
To solve error '/usr/lib/libzbarqt.so: undefined reference to QX11Info::display()', I have build Qt with X11.Now I am getting error:libzbarqt.so: undefined reference toQWidget::qwsEvent(QWSEvent*)' error.
In general, you could make sure that the symbols are present in the library unless it is built without symbols. I usually use the nm -a and objdump utilities for that operation.
More to the point: it seems that the zbar dynamic library that you have was built against the embedded version of Qt rather than the desktop Linux.
It is an unfortunate issue that both versions have the same dynamic library file names, so things like ldd cannot be much of help.
You will need to make sure to use exactly the same version of Qt installation that the library was built against. This means, if you use the desktop Linux installation for this, it will not work.
I used CMake and Visual C++ to build the HyDE library. Then, still in VC++, I was able to successfully create code and build an executable that links into HyDE.lib and the HyDE header files.
I then discovered that in order to work with others at my company, it would be preferable to develop in Eclipse CDT. Knowing very little about Eclipse CDT, I created a default hello world project, deleted the code and then dumped in all of my code into the src folder. Then I attempted to change the includes and lib path and libs to mirror what had worked in VC++. At this point everything seems to compile, but I get an error in linking:
/cygdrive/c/EclipseWorkspace/425HyDE/Debug/../src/FS5HyDE.cpp:16: undefined reference to `HyDEAPI::HyDE::HyDE(HyDESystemModel::SystemModel*, bool)'
(There are many more errors like this, all referring to HyDE methods.) Here is what is being run at the command line:
g++ -L"C:\Progra~1\boost\boost_1_42\lib" -L"C:\EclipseWorkspace\HyDE" -o"425HyDE.exe" ./src/Adapter_FS5HyDE.o ./src/EPSCommands.o ./src/EPSCurrentSensor.o ./src/EPSFault.o ./src/FS5HyDE.o ./src/HyDEObservation.o ./src/MCDH.o ./src/MCDH_Module.o ./src/PDBComponent.o ./src/PowerSystem.o ./src/Program.o ./src/SSPCComponent.o ./src/Telemetry.o ./src/TelemetryReport.o -l:libboost_thread-vc90-mt-gd-1_42.lib -lHyDE
This is definitely not a library ordering problem because I've the other ordering as well (there are only two). Is it possible that there is a problem with compiling HyDE.lib in VC++ (which uses a Windows compiler) and compiling my program with g++? Could there be a problem in the way that Eclipse CDT is autogen'ing the makefiles? Any other ideas?
(Note: there appear to be plenty of others questions on SO with similar problems, but after reading through them I have yet to find one that addresses my problem.)
Classic missing symbol error. Which source file defines:
HyDEAPI::HyDE::HyDE(HyDESystemModel::SystemModel*, bool)' ?
Was this file added to the compilation? Can you spot it on the command line you pasted?
If this symbol belongs to an external library, after adding the directory path with -L , you could add the name of the specific library you want to link with your program using -l.
I'm going to suggest that you try to add to the compilation command the directory path to HyDE.lib, followed immediately by the library name, like this:
-L"C:\path_to_hyde_library" -l:HyDE.lib
and then tell us what happened.
Solution: Since the HyDE library was compiled with the Visual Studios compiler and I'm attempting to build the code that links to it with the Cygwin toolchain the two compilers use different name mangling schemes so that the latter linker can not find the expected symbols in the HyDE library. The only solution that I've found is to recompile the HyDE library with the Cygwin toolchain or compile the new code with whatever compiler Visual Studios is using. (grumble grumble)
./src/FS5HyDE.o and ./src/HyDEObservation.o should be the latest parameter if other object files (*.o files) need them, it means that the most needed object files should be appeared as last as possible in the parameters list.