Using libtom/lbtomcrypt in Eclipse - c++

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'

Related

Linking to Boost Regex library in VS2012

I'm trying to build my VS2012 C++ project using Boost Regex library. It seems that the linker does not find the library and gives the error:
error LNK1104: cannot open file 'libboost_regex-vc110-mt-gd-1_50.lib'
In "Project Properties:Linker:General:Additional Library Directories", I included a path which (within a subdirectory) contains a library named boost_regex.lib.
This was built by a 3rd party framework (FireBreath), and I shouldn't change it. How do I get VS2012 to use this library instead of looking for one under the name referenced in the error?
Firstly, what makes you so sure that the boost_regex.lib is the right one? Is it even for your compiler and version? I also doubt that it is for the debug variant of the runtime library. My guess is that you will have to build this for the compiler that you're using and properly install it, for which there are instructions at the Boost website. This might also imply rebuilding FireBreath for your compiler, assuming that's a C++ library, too.
Then, the code in Boost that detects compiler settings and then selects a library to link against is correct for normal setups. This code uses "#pragma comment(lib, ...)" to specify the lib to link with, so you should be able to find the code. There, you should also be able to detect the macros that turn this feature off. However, you are probably not fixing anything with that but rather you are creating more problems.
Substituting the library is not something you want to do. Instead:
Download Boost into, say, c:\boost
Open a VS command prompt, go into c:\boost and run bjam. When this is done, run b2. Wait.
Now go into your project and add c:\boost\stage\lib to the Additional Library Directories setting.
This will allow you to build the project.

POCO libraries in C++ Builder

I compiled the POCO libraries in VC++, then I used Builder's implib to make libraries for Builder. I added these library files in my application's debug directory, however, linker still throws errors like
Unresolved external 'poco::session::...'
Could you please tell me what is the proper way to import the POCO library in my C++ Builder application?
One way to do it is to build the POCO libraries in C++ Builder directly. The POCO distribution doesn't come with a .cbproj file, but I found that it wasn't too difficult to figure out which files are required and then create my own Poco_Foundation.cbproj in C++ Builder.
If I recall correctly, there are some portions of Poco (involving template specialization) that C++ Builder won't compile. I was able to work around a lot of the compile errors, but I had to just exclude some of the units because they had too many dependencies on the units that don't compile. Most of the problems I found were in the Poco_Net library; I think the Poco_Foundation library compiled pretty easily.
Good luck.

g++ linking .so libraries that may not be compiled yet

Im helping on a c++ application. The application is very large and is spread out between different sub directories. It uses a script to auto generate qt .pro files for each project directory and uses qmake to then generate make files. Currently the libraries are being compiled in alphabetical order.. which is obviously causing linking errors when a library its trying to link isn't built yet.. Is there some kind of g++ flag i can set so it wont error out if a library its trying to link hasn't been built yet? or a way to make it build dependencies first through the qt .pro file?
NOTE:
This script works fine on ubuntu 10.10 because the statements to build the shared libraries didnt require that i use -l(libraryname) to link to my other libraries but ubuntu 11.10 does so it was giving me undefined reference errors when compiling on 11.10.
Have you looked into using Qt Creator as a build environment and IDE? I've personally never used it for development on Ubuntu, but I have used it on Windows with g++, and it works great there. And it appears its already available as a package in the repository.
Some of the advantages you get by using it are:
Qt Creator will (generally) manage the .pro files for you. (If you're like me, you can still add lots of extra stuff here, but it will automatically add .cpp, .h, and .ui files as they are added to the project.)
You can set up inter-project dependencies that will build projects in whatever order they need to link.
You can use its integration with gdb to step through and debug code, as well as jump to the code.
You get autocomplete on Qt signals and slots, as well as inline syntax highlighting and some error checking.
If you're doing GUIs, you can use the integrated designer to visually layout and design your forms.
Referring back to your actual question, I don't think it's possible for a flag to tell gcc to not error when a link fails simply because there is no way for the linker to lazily link libraries. If its linking to static libraries (.a), then it needs to be able to actually copy the implementation of that code into the executable/library. If its dynamically linking (.so), it still needs to verify that the required functions actually exist in the library. If it can't link it during the linkage step, when can it link?
As a bit of an afterthought, if there are cyclic dependencies in your compile process (A depends on B, B on C, and C on A), then you might need to have a fake version of a library get built first, which only has empty stubs for the implementation of each function, and the full definition for each class or object. Then, build everything else while linking to that, and at the end, build the real version of the fake library, and link it to all the other versions that were already linked. I think this would only work on dynamic linking, though.
You could use a subdirs project to have control over the build order (no matter whether the other dev wants it or not :) ).
E.g.
build_all.pro
TEMPLATE=subdirs
CONFIG+=ordered
SUBDIRS=lib2/lib2.pro lib1/lib1.pro app/app.pro
The lib1.pro, lib2.pro, ... are your generated pro files.
Then run qmake once for the build_all.pro and also run make in that directory. This will build lib2 before lib1 and then app.

SjLj undefined while trying to develop a Qt application using Netbeans

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.

Trouble with boost and Code::Blocks

I've been trying to get the boost library working with Code::Blocks and am having some trouble.
When I first tried to get boost, all I did was download the latest zip file and extract it into the CodeBlocks folder. Then I set the compiler settings to look in the boost folder. This allowed me to compile, but not to link. I then read the BoostWindowsQuickReference. I removed everything I had related to boost from my machine, and started fresh.
I followed the instructions step by step, and the only thing that didn't go exactly as the instructions said was that the install-proper folder with the include\boost inside of it was in C: and not my CodeBlocks folder. So I simply copied it (just in case for some reason it needed to be there) to the CodeBlocks folder, which I thought odd because I already had a boost_1_40_0 folder there from downloading the .zip.
I then tried to compile a program and it came up with the exact same error. Then I realized that I forgot to put in the link library (Ex: boost_regex-mgw44-mt-1_40.lib). Now I get
error: ld.exe||cannot find -lboost_regex-mgw44-mt-1_40.lib|
I have a few questions:
Obviously, what am I doing wrong?
Will I need to put in a link library every time I want to use a boost facility (everything is separated into different files, there isn't just one big project.)
Was it necessary to build the library with the boost-jam or could I have just extracted it and used it? (Probably a dumb question, but a small seed of doubt was planted when I got the exact same error.)
Should I try nuwen's MinGW Distro? (Would it make things any easier?)
If any clarification is needed I'd be happy to do so. Thanks.
Edit: and now I can't compile regular programs. So I'm just starting fresh again.
1, it should be -lboost_regex-mgw44-mt-1_40
2, Read the document, most boost library doesn't require to link library
3,4, You should compile it yourself, or try nuwen's MinGW ( I'd installed it and it worked fine )
BoostPro has Windows binaries available for the Boost libraries. If you download just the Boost sources, you will have to compile it, if you are using any of the libraries that are not header-only (such as boost regex). The BoostPro binaries will allow you to link to these without having to build anything.
On Windows it doesn't really matter where you "install" Boost to. Just get the .7z, compile using bjam.exe and pass it the options you need. It will create a folder called "bin.v2" and put the resulting libs in there. In Code::Blocks, all you need to do is edit the project options and point the search path to boost_1_40_0\boost and manually input the libraries to link against (those from bin.v2). It should just work then.
Do not use a precompiled Boost library.