-
June 13th, 2012, 02:54 PM
#1
A question regarding VS project setting
I have a solution containinging multiple projects. If I change a file in a project and then select Build/Build solution, sometimes the break point set in that file won't be hit. I have to rebuild that project which contains the changed file and select Build/Build solution, then the break point will be hit. Why? Thanks.
-
June 13th, 2012, 03:14 PM
#2
Re: A question regarding VS project setting
If you set the dependencies all projects that are needed are built
-
June 13th, 2012, 03:29 PM
#3
Re: A question regarding VS project setting
Like SMA said, you need to set the build order of the sub-projects (which project depends on which).
Viggy
-
June 13th, 2012, 04:42 PM
#4
Re: A question regarding VS project setting
Originally Posted by S_M_A
If you set the dependencies all projects that are needed are built
But when I select Build/Build Solution, the compiler should know which project has been changed, as the result, all of the projects that depend on that project should be also compiled, right? Thanks.
-
June 13th, 2012, 05:07 PM
#5
Re: A question regarding VS project setting
all of the projects that depend on that project should be also compiled, right?
They will, right. But build order matters. This is what dependency is about.
Best regards,
Igor
-
June 13th, 2012, 05:17 PM
#6
Re: A question regarding VS project setting
Originally Posted by Igor Vartanov
They will, right. But build order matters. This is what dependency is about.
Okey, let's say I have projects in the build order as A, B, C, D, E. At one point, I change project C. I assume when I select Build/Build Solution, the compiler will build the projects in the order as A, B, C. It should be perfectly fine, right? But how come a break point set in project C won't be hit in this scenario? Thanks.
-
June 13th, 2012, 06:07 PM
#7
Re: A question regarding VS project setting
This indicates that debug database has no corresponding entry for the line. This may be due to changes in D or E, for example. Or A or B depend on C but occur rebuilt with older version of C due to wrong build order.
Last edited by Igor Vartanov; June 13th, 2012 at 06:10 PM.
Best regards,
Igor
-
June 14th, 2012, 09:46 AM
#8
Re: A question regarding VS project setting
Originally Posted by Igor Vartanov
Or A or B depend on C but occur rebuilt with older version of C due to wrong build order.
Can you explain how wrong build order can possibly cause A or B rebuilt with oder version of C? I didn't change the build order whatsoever. The build order always stay what it is. Thanks.
-
June 14th, 2012, 12:33 PM
#9
Re: A question regarding VS project setting
Frankly, why spending time on arguing about it? I have never ever experienced the issue you describe in a multi-project solution where the dependencies are properly set. If they are not set, well sooner or later the issue show up...
-
June 14th, 2012, 01:23 PM
#10
Re: A question regarding VS project setting
Originally Posted by LarryChen
Can you explain how wrong build order can possibly cause A or B rebuilt with oder version of C? I didn't change the build order whatsoever. The build order always stay what it is. Thanks.
I thought it's kinda obvious.
- You have A.exe dependent on B.lib, when A builds first
- You have some B.lib already built to the moment
- You make change in B sources and put a break point on a newly added line
- You run Build All which starts with building A
- A gets built linking with old B.lib, because old B.lib exists, and B has not been built yet with new changes
- B gets built fine, but newly added lines are not in A.exe
- You run A.exe, but break point never hits, because A has been built with old version of B having no those lines in
Best regards,
Igor
-
June 14th, 2012, 02:56 PM
#11
Re: A question regarding VS project setting
Originally Posted by Igor Vartanov
I thought it's kinda obvious.
- You have A.exe dependent on B.lib, when A builds first
- You have some B.lib already built to the moment
- You make change in B sources and put a break point on a newly added line
- You run Build All which starts with building A
- A gets built linking with old B.lib, because old B.lib exists, and B has not been built yet with new changes
- B gets built fine, but newly added lines are not in A.exe
- You run A.exe, but break point never hits, because A has been built with old version of B having no those lines in
But since B has changed, how come B is NOT compiled before A since A depends on B?
Let's say I have a solution containing projects A, B, C, D, E which are in the build order. If I change C and then build the solution, the compiler should detect C's changes. Since build order is preset as A, B, C, D, E, so compiler should compile A, B and then C. And then the linker should eventually link the objects of A, B and C with the executable. This is what I assume how build works. My question is how 'd it happen that the linker is trying to link old version of C object with the executable? Thanks.
-
June 14th, 2012, 04:01 PM
#12
Re: A question regarding VS project setting
Originally Posted by LarryChen
But since B has changed, how come B is NOT compiled before A since A depends on B?
That's what's happening if you set the dependencies.
-
June 15th, 2012, 02:39 AM
#13
Re: A question regarding VS project setting
Originally Posted by LarryChen
But since B has changed, how come B is NOT compiled before A since A depends on B?
Let's say I have a solution containing projects A, B, C, D, E which are in the build order. If I change C and then build the solution, the compiler should detect C's changes. Since build order is preset as A, B, C, D, E, so compiler should compile A, B and then C. And then the linker should eventually link the objects of A, B and C with the executable. This is what I assume how build works. My question is how 'd it happen that the linker is trying to link old version of C object with the executable? Thanks.
Larry, this is the very point where you're wrong. Build goes per project in your solution. Every project builds completely before building next project. This cannot be done other way just because some project may depend on other project build resultant binary (.lib, or .dll, or even .exe in some cases).
Last edited by Igor Vartanov; June 15th, 2012 at 02:43 AM.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|