[PATCH] Fixing bad library include path in VS2010


#1

Hi,

I haven’t tested with other VS version, but at least on VS2010, the library path in Introjucer is completely ignored, because it’s not filled in the right place in the project file.
Here’s the patch that’ fixing it for VS2010, and shouldn’t break for other version (not removing the wrong code, since it’s ignored by VS2010, I wonder it’s good for previous version)

// In jucer_ProjectExport_MSVC.h around line 1207
                if (! isDebug)
                {
                    link->createNewChildElement ("OptimizeReferences")->addTextElement ("true");
                    link->createNewChildElement ("EnableCOMDATFolding")->addTextElement ("true");
                }

+                const StringArray librarySearchPaths (config.getLibrarySearchPaths());
+                if (librarySearchPaths.size() > 0)
+                    link->createNewChildElement ("AdditionalLibraryDirectories")->addTextElement (librarySearchPaths.joinIntoString (";") + ";%(AdditionalLibraryDirectories)");

                String externalLibraries (getExternalLibrariesString());
                if (externalLibraries.isNotEmpty())
                    link->createNewChildElement ("AdditionalDependencies")->addTextElement (replacePreprocessorTokens (config, externalLibraries).trim()

Thanks.


#2

Eh…?

It sets the paths at line 1120, and this definitely works, because a project that I’m working on at the moment makes extensive use of library paths!


#3

No, it’s wrong.
It set the “” node inside some other parent node (not in the node), and this node is completely ignored by VS2010 (try it, it doesn’t even appear in the linker command line).
You need to set the in the node to this to work in VS2010 (not sure about previous version).
If you still have VS2005 in your virtual machine, you’ll probably be able to try the change in both software, so you’ll assert the new change doesn’t break VS2005/VS2008, but allow VS2010 to work (while the current code doesn’t without the fix).


#4

The existing code definitely works!

I’ve been happily building several apps with VS2010, using library paths, for a long time. There’s no chance that my stuff would compile if those paths were being ignored.

Just to prove that I’m not going mad, I just checked it, and can see that my paths appear in the VS properties page under “Configuration Properties” / “VC+ Directories” / “Library Directories”. I can post a screenshot if you refuse to believe me!


#5

I believe you (I’ve seen it).
However, what I’m talking about is the Link library search path.
The former is used when you “pragma comment(lib)”, but the later is used when you list libraries in the link property page. (See the project page: Linker / General / Additional Library Directories"

In all case, you can apply the patch, it does not break anything and provide a feature I need.


#6

Nice job microsoft, two different paths depending on how you link a library? Genius.

Sorry about the confusion, I’ll add your patch!