1

While the Microsoft compiler typically builds faster code, I'm in an environment where building Linux applications with gcc is required. I prefer MSVS and the Express versions as my IDE and have been able to configure it such that Intellisense and all the other nice features are working. However, I have been unable to find an easy way to get VC++ Express 2010 to build using gcc. I'm not sure if I remember correctly, but I thought about half a decade ago there was support to switch compilers when using MSVS.

I have found an extension to download claiming to do this, but it costs about $50. Does anybody know of any free or open source tools that can accomplish the above?

Hazok
  • 5,373
  • 4
  • 38
  • 48
  • http://stackoverflow.com/questions/216025/gcc-with-visual-studio – Yippie-Ki-Yay May 03 '11 at 21:30
  • Probably not - VS Express doesn't allow extensions. – nobody May 03 '11 at 22:07
  • Sorry, wrong word... "External tool" would have been better usage. Not that it's difficult to pick up on the meaning from the above explanation, but nitpicking does help keep everyone's vocabulary in check. – Hazok May 03 '11 at 23:45

2 Answers2

1

As I realize there are no plugins, but you could simply setup some custom build rules and make gcc compile your project instead of the cl.

Google for the Custom build rules in Visual Studio / provide your own makefile. Also note that if you wish to still have the ability to debug your applications, you should probably look for something like WinGDB.

The good thing in this approach is that you can switch your configurations from cl to gcc, for example and easily test if your application remains compilable in both of them.

Still, the best way would probably be to use some automatic building tools like cmake or scons, which simplify the process greatly and can help you to switch to any other IDE in a matter of minutes.

Personally I like scons, because it's python-driven, but cmake is very nice to start from.

Yippie-Ki-Yay
  • 22,026
  • 26
  • 90
  • 148
  • Also to mention, that **faster code** by `cl` is obviously a myth. – Yippie-Ki-Yay May 03 '11 at 21:41
  • Unfortunately, Googling for that search screen returns a lot that doesn't get to what I'm asking for. I'm not the only person that has looked for such a tool, so if it's as simple as you say then it's likely someone else has already done it. I'm not trying to recreate the wheel and develop a new tool here... I'm looking for something that will be easy to import into what I'm already doing. – Hazok May 03 '11 at 23:34
  • Ah, see, I'm not the only one... I just found a better [explanation](http://stackoverflow.com/questions/1926311/cygwin-in-visual-studio) of the issue, the majority of which I've already tackled. The last piece is getting gcc to work without having to modify the file extensions or to just find a tool to do this (like I mentioned previously, there are tools like this available, such as the WinGDB you mentioned, but I'm looking for **free** or **open source** tools). – Hazok May 03 '11 at 23:43
1

Try CMake: http://www.cmake.org/. It is a cross-platform, cross-ide build system. It will generate
VS project for you, and ordinary makefiles (or eclipse, or what you need). Then, use VS to edit the code, and "make" to build it. I did it myself to develop windows + linux on virtual machine. And it worked fine.

Piotr
  • 833
  • 5
  • 12
  • Can this be done directly in the IDE? I already have makefiles and can build from command line, the goal here is to get VC++ to build using gcc instead of cl. – Hazok May 04 '11 at 01:57
  • No, it can't. You need to create "special makefiles" for it. Then run "generator" which will create VS solution and makefiles. – Piotr May 04 '11 at 10:07
  • Bummer. After much searching on this, it seems there's really no open source or free tool to accomplish this. I'll play around with the cmake this weekend though and see what I can do. Maybe I'll end up making my own tool and contribute to the open source cause (I just think it would be awesome to force a Microsoft tool targeted to work for Linux). – Hazok May 05 '11 at 01:16
  • PS - If that works decently well, I'll upvote your answer and if I can somehow wrap CMake as an external tool and get it done directly from the IDE, I'll definitely give you the answer on this one. – Hazok May 05 '11 at 01:17