开发者

How to create Visual studio solution from make files?

开发者 https://www.devze.com 2022-12-24 19:54 出处:网络
I have a source code for a pr开发者_StackOverflow社区oject with their make files. I want to create a Visual Studio (2005) solution from it. Is there any direct way to do this? can anyone help me pleas

I have a source code for a pr开发者_StackOverflow社区oject with their make files. I want to create a Visual Studio (2005) solution from it. Is there any direct way to do this? can anyone help me please. I spent hours for searching, but couldn't find a way to do this.

Thanks.


Unfortunately, Microsoft removed this capability after VC++ 6.

If all you're looking to do is to build a Visual Studio project from a command line or script, you can use the devenv command to build using the settings in a project.

Something like:

devenv /build debug /project myproj myapp.sln 

Ans starting with VS2010, C++ projects will use the MSBuild system, so you can drive builds using that technology.

If you really want a makefile, you'll need to write it up by hand (or maybe there's some 3rd party tool out there that I'm unaware of).


I'm not sure whether this solution can help you. Which I tried and it worked well in my previous projects. It need manually add the files.

  1. Create a blank VS solution/project. Add the source files into that project.
  2. Mark all source files as "Excluded from building". You can right click the files in project explorer and find the setting. So now nothing will happen when you build your project.
  3. In project setting, find something like "Custom build step". Add the commands that invoke your original build command. (You may write different build command for debug/release ). You can also set the post-build actions such to copy your result to some folder....
  4. Now you can edit and build source files.
  5. For my experience, I can even debug it after setting the executable.

Hope this can help you.


If this is a one-off then it is easier to just create the VS project manually in visual studio.

If you are going to need to do this often look at ceating the project in something like cmake or Qt's .pro whcihc an generate makefiles and VS build files from the same defintion.


Do you want to use the makefile to build? You can create a project from existing source in VS 2005 and setup the project to use make to build (and the wizard will take you through all of this).


I am using VS2010.In order to build you can create a project from existing code. In VS2010 you can create project from existing code File->New->Project from Existing code. You can specify the other parameters and then ready with the solution. I did not go with make file but followed this approach which is working great.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号