I am an old Unix guy who is converting a makefile based project over to Microsoft V开发者_开发知识库isual Studio, I got tasked with this because I understand the Makefile which chokes VS's automatic import tools. I am sure there is a better way than what I am doing but we are making things fit into the customer's environment and that is driving my choices. So gmake
is not a valid answer, even if it is the right one ;-)
I just have a couple of questions on terminology that I think will be easy for an experienced (or junior) user to answer.
Presently, a make all
will generate several executables and a shared library. How should I structure this? Is it one "solution" with multiple projects? There is a body of common code (say 50%) that is shared between the various executable targets that is not in a formal library, if that matters.
I thought I could just set up the first executable and then add targets for the others, but that does not seem to work. I know I am working against the tool, so what is the right way?
I am also using Visual C++ 2010 Express to try and do this so that may also be a problem if support for multiple targets is not supported without using Visual C++ 2010 (insert superlative).
Thanks, this is really one of those questions that should be answerable by a quick chat with the resident Windows Developer at the water cooler. So, I am asking at the virtual water cooler, I'll also spring for a virtual frosty beverage after work.
Visual Studio is in many ways concerned with outputs. In general it expects for a 1-1 mapping between projects and binary outputs (DLL's, EXE's, shared libs, etc ...). Hence the best way to format your solution structure is to create one project per output.
So
- One project for the shared lib
- One project for each of the executables
Assuming the executables link against the shared lib, you'll want to configure the build order to have the shared lib build first and the executables afterwards. This can be done by right clicking on the solution file and selecting "Build Configuration". Also available under the build menu.
精彩评论