Build Dependencies

I've encountered a weired problem and don't know how to solve it.
I'm using VS2012. My problem is that the linker won't find a lib (LNK1104) that I told him he needs to build upfront.

So here it comes:
Two projects in one solution
- One lib
- One exe depending on the lib
- Output for both: "$(SolutionDir)bin\$(Platform)\$(Configuration)\"
- Additional lib dir for the exe: "$(SolutionDir)bin\$(Platform)\$(Configuration)\"

First: If I build the lib and then the exe it works fine. If I say "rebuild entire solution" it won't work. Moreover the output path is completly empty although I get the following console output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1>     Creating library C:\Develop\solution\bin\x64\Debug\MyLib.lib and object C:\Develop\solution\bin\x64\Debug\MyLib.exp
1>  MyLib.vcxproj -> C:\Develop\solution\bin\x64\Debug\MyLib.dll
1>   Volume in Laufwerk C:
1>   Volumeseriennummer: 7E06-92C1
1>  
1>   Verzeichnis von C:\Develop\solution\bin\x64\Debug
1>  
1>  15.08.2013  11:07    <DIR>          .
1>  15.08.2013  11:07    <DIR>          ..
1>  15.08.2013  11:07            41.984 MyLib.dll
1>  15.08.2013  11:07               999 MyLib.exp
1>  15.08.2013  11:07           238.132 MyLib.ilk
1>  15.08.2013  11:07             2.266 MyLib.lib
1>  15.08.2013  11:07           363.520 MyLib.pdb
1>                 5 Datei(en),        646.901 Bytes
1>                 2 Verzeichnis(se), 175.886.725.120 Bytes frei

I get the dir output because I've put dir $(SolutionDir)bin\$(Platform)\$(Configuration)\ in the post build event for the lib.

After this output I receive the message:
 
2>LINK : fatal error LNK1104: cannot open file 'MyLib.lib'

Even more obscure: If I open the path in an explorer it is completly empty.

Can anybody help? It's weired because manually I can build them direclty after each other and it works fine but if I try to build the entire solution it just won't work.

Cheers
Nico
Last edited on
Have you set up the project dependencies?

How to: Create and Remove Project Dependencies
http://msdn.microsoft.com/en-us/library/et61xzb3.aspx

Andy
Indeed I have.

But I found out the reason. The trick is to Clean & Build the solution instead of rebuilding it.
Rebuilding cleans as well but the cleaning is invoked for every project again and again. But every project has the same output folder ;) Thats why only the last building one remains in the out dir ^^

Just building the solutin prevents this effect and everything's just fine ^^
Topic archived. No new replies allowed.