Add library to C/c++ eclipse indigo project - c++

I am trying to add a library to C/C++ project in Eclipse by the following procedure:
Properties->C/C++General->includes (within includes specifying the folder in which the library is kept).
Properties->C/C++General->Library Paths (Specifying the library paths of .so and .a files)
Properties->C/C++General->Libraries (Specifying adding paths of .so and .a files)
But when I build the project,it is not able to find the path of header files that I am including in my project.
Can someone please tell me where the error is?

A similar question was posted here. You need to add the libraries in the Properties -> C/C++ -> Build area, not the General area.
Hope this helps.

Related

Updating Netbeans C++ Makefile

I added some outside library files to my C++ project in netbeans within my Source folder. However the makefile doesnt seem to build them. I cant figure out how to add them to my makefile to have them included in the build. Has anyone done this before?
Thanks!
Did you add it as source files or as compiled library?
Source files: You need to add them to your Netbeans project (not only place them into the folder). Otherwise they aren't compiled when building it.
Compiled library: This typically needs two settings: Add the library to the linker (Build -> Linker -> Libraries) and add the libraries header path to the include path (Build -> C++ Compiler -> Include Directories)

How do I add a library to my NetBeans C++ project?

I want to use the boost library in order to use some of its functions but I don't know how to do so and cannot seem to find an answer.
I'm currently using NetBeans 8.0.1 ,any help is appreciated.
You have to add two things:
(a) Library header
Go to …
Project Properties -> C++ Compiler -> Include Directories
add the header's directory path there.
(b) Library binaries
Go to …
Project Properties -> Linker -> Additional Libraries Directory
and add the directory path- that's where your library binaries are.
Next add your library at:
Libraries.

cannot open file 'SDL2.lib'

I am trying to open sdl2 in my project on Visual C++ 2012 but i keep getting this error:
error LNK1104: cannot open file 'SDL2.lib'
I added the additional libraries and include folder but no luck..
I added the link to the libraries through the linker but i get the same error..
what should i do?
I'm referencing VS 2010, but I've read before that some people have had errors when using the VC++ Directories in their project properties as opposed to the Linker->General->Additional Library Directories.
Unfortunately, there really isn't much more to do besides making sure the directories are linked properly. There really is only one answer to this question. It also may depend on the download of SDL you chose, are you donwloading the Development Library as opposed to the binary?
Watch this video https://www.youtube.com/watch?v=or1dAmUO8k0.
In summary, you want to add the path include folder here: (configuration properties> C/C++ > General> Additional Include Directories),
and add the path of the lib folder here: (configuration properties> Linker > General> Additional Library Directories)
and finally, link .lib file in: linker > input > Additional Dependencies.
It seems like you didn't add your library directory path in VC++ Directories/Library Directories.. You have to link your library directory path (Where you have save you libraries of SDL) in your program. After adding, it will definitely work
I would like to add for others experiencing this problem that its an easy mistake if you are using the Development Library to link to the lib folder. SDL needs you link to either the x86 or x64 folder in the lib folder.
If you run or compile your program before you make those required changes of SDL then you will get this error always.. so first add a c++ file then make those changes and then write something and try to run ..this time it will never give this error
It seems like VS can't find the lib files. There are two ways you can do this. One is to configure the appropriate directories in VS as TwinkleBearDev's article shows. Another is to put the libraries directly where VS would look for them, as my article shows. I don't know if the folders for VS2012 are the same though - might be slightly different.

How to add lib files and headers to a C++ Project

I have been using libcurl in a C++ project.
I have added the libcurl Include and Library directory's to the VC++ Directories and added the .lib file to the Linkers Input Additional Dependencies.
Everything works fine but when I check in my code (TFS) and somebody gets it on another machine they cannot build etc due to not having libcurl installed on their machine or installed in different paths etc.
How do I add all the necessary files to my C++ Solution so that anyone getting the project from source control can build and link without error.
Thanks
The solution I went with was too add the library file to a folder within my solution, then add
$(SolutionDir)libs\curllib.lib
To the Additional Dependencies within Linker->Input
You can not add the library to the solution. you should distribute the library along the source code. Place it in a subdirectory of the project so that it goes along the whole project source. Then configure the path in Additional Library Dependencies. That way the people should be able to link appropriately when building from source.

How can I include Lua library in VS 2008

I'm not sure about this location.
In Properties > Linker > General > Additional Dependencies
I have to include some library in Additional Library Directories, haven't I?
or I have to install some program in my computer?
The problem is I can't to use luaL_dofile, but I can use it before my computer was formatted.
That's why I'm not sure about library. I compile and run my code after my
computer was formatted suddenly. I'm pretty sure that my code has no problems
because it can run before my computer was formatted.
Well, then, obtain the library from where you get it. Place it in some place that you know it will not be moved (or install it if an installer is provided), and do this:
Select menu item Project -> Properties -> Configuration Properties -> Linker ->Input.
Now add the name of the library in the "Additional Dependencies" edit control.
You need to do two things:
Add the library directory to Libraries directory
Add the library name (without path, but with extension) to Linker->Input->Additional Dependencies