Additional Dependency and Additional Library Directory


#1

i need to specify Additional Dependency(*.lib) and their path while i am configuring my project using Introjucer so that i won’t have to specify that manually after generating .sln file. Does anybody know how to set that in Introjucer ?


#2

In Visual studio it’s much easier to use #pragma comment (lib, “xyz”) to specify your libraries than to put it in the project settings.


#3

thank for the reply…

But if i set them in extra linker flag and library header path, I can see them in Linux Makefile but they are not visible in Visual studio where it should come as additional dependancy and additional include library path…

I am setting it manually in Solution’s property for a now. And project works fine too. But I am trying to find a way to make it automatic and single time setting.

Please suggest.


#4

Sorry, maybe I don’t understand your question.

Are you saying that you’re setting the VS library search path, but it isn’t working? (I can’t see how that would be the case because I use it all the time myself)


#5

i am setting *.lib file in following way…
See image 1.JPG…

And providing path as following…
See image 2.JPG…

and i am getting following configuration in .sln properties instead of .lib file and their path i am getting empty one.
See image 3.JPG…


#6

Nope, can’t see those images, I’m afraid.


#7

sorry for a bit inconvenience… you will be able to see it now…
if possible please give us any example of project generated using Introjucer.


#8

The “linker flags” section is for linker flags. It’s not a list of librarie names (and it looks like you spelt your library’s name wrong anyway!)

And the paths will show up in the “VC++ Directories” section, not the one you highlighted.


#9

Hey Jules thanks again …

Yup U are right… in hurry i typed wrong library… It’s “pugixml” :wink:

But really I don’t get it what you are saying “VC++ directories” I don’t see such options in Introjucer… If possible provide some example through which I can set my libraries Right (*.lib - *.dll / *.a - *.so) and their directory where compiler can find the respective Lib files.


#10

i got you…but where am i suppose to do this configuration in Introjucer…? and i didn’t find anything name as VC++ Directories in Introjuce…


#11

No, you did it right in the introjucer, but in MSVC it shows up under the “VC++ Directories” section.


#12

Ok… Got it… It is showing in VS properties page…

But still My issue is pending … Where shall i set *.lib and it’s directories ? Please make it clear … So i can have fully automatic running Introjucer based project …


#13

Your path is correct. Just add a pragma in your code to load the library, or figure out what the linker flag is to do that.


#14

Bah, you mean with a “#ifdef _MSC_VER / #else / #endif” chain, WTF ?
It looks bad to me. A library is something that’s linker’s specific, using a compiler hack to change a linker parameter is wrong to me.
With ld, it’s -lmylib, and on Visual Studio, on the linker command line, you simply append the .lib file


#15

Specifying libraries through a #pragma in the source code is SO MUCH MORE CONVENIENT than fiddling around with the settings in an IDE-specific project file!!!

IDE-specific settings should be avoided as much as possible.

Both approaches are going to be platform specific anyway, so why not use the choice that is easier? If you put it in the .cpp or the .h file then it is visible to everyone no matter what IDE or platform they are on. It can also be edited without having to run IntroJucer.


#16

Let’s say… If I am using some third party library, And they have not used pragma directive in their code,
SO in that case I have to set those .lib in visual studio project by self…
Right ?
But atleast It must be way to set library directory location setting, I see that those are coming as vc++ directories. But VS has specific property for it as additional library directory, which is not getting filled by IntroJucer … But I do it manually too ;-)…

Thanks all for your kind responses …


#17

[quote=“TheVinn”]Specifying libraries through a #pragma in the source code is SO MUCH MORE CONVENIENT than fiddling around with the settings in an IDE-specific project file!!!

IDE-specific settings should be avoided as much as possible.

Both approaches are going to be platform specific anyway, so why not use the choice that is easier? If you put it in the .cpp or the .h file then it is visible to everyone no matter what IDE or platform they are on. It can also be edited without having to run IntroJucer.[/quote]
Bullshit. It happens that a particular compiler allows you to do such a hack, and you argue that’s the way to do it. It’s not. Libraries are something that are specific to a linker. What happen if I have to change the lib to something else (for example, -lelectricfence instead of -lmalloc ?) ?
What happen if I want to use a library that’s at a particular place/version, but some deep buried source file decide to #pragma include some library without me knowing it ?
It’s not cross platform either (obviously, since there is no linker in some compiler suite, so I wonder how they would pass such hack to the linker options).
The only and right way to do it, is to put a library list in the introjucer and some path, and let the introjucer write the right thing for your development platform.
Don’t pollute your code with compiler specific hack as #pragma comment, it’s ugly, unsafe (since you don’t know which library is selected by the compiler at the time of compilation), not cross platform (so you still have to write the right options in your makefile/xcode anyway).

It’s the same thing as saying “I disable warning since it’s so more convenient not to have the compiler complain about me being lazy”.


#18

But for a now, there is no way Introjucer do that setting in according IDE or platform we generate build for it. SO setting manual library is the best way to go… right ?


#19

Sure there is. As I said in my previous post, you can put the .lib file (for example “pugixml.lib” in the “Extra linker flags” of the Visual Studio project page), and the library path in the “Extra library search path”. Beware that you must add “…” to your windows path.
For linux, you have to add “-lpugixml” in the “Extra linker flags”, and the path in the “Extra library search path”.
For xcode, I wonder it’s the same.

It’s a shame the IJ doesn’t have a “extra library list” entry where we would avoid doing per-config work, but currently it does work like this.
Also, a “Browse” button for specifying folder would be a pain killer, instead of manually entering path (which requires at least 2 round-trip with the IDE to figure out the real relative path to put there)


#20

[quote=“X-Ryl669”]Sure there is. As I said in my previous post, you can put the .lib file (for example “pugixml.lib” in the “Extra linker flags” of the Visual Studio project page), and the library path in the “Extra library search path”. Beware that you must add “…” to your windows path.
For linux, you have to add “-lpugixml” in the “Extra linker flags”, and the path in the “Extra library search path”.
For xcode, I wonder it’s the same.
[/quote]

Yes, it does work for linux…
But for Windows, We tried it before and checked again as you suggested but that’s not working for Windows…