开发者

Compiling Visual C++ code in linux

开发者 https://www.devze.com 2023-03-13 07:12 出处:网络
I have written a code in visual c++ , which is a sort of GUI used in virtual com PORT connection. However , i need to run that code in linux so that i c开发者_运维知识库an make it an open source. Sinc

I have written a code in visual c++ , which is a sort of GUI used in virtual com PORT connection. However , i need to run that code in linux so that i c开发者_运维知识库an make it an open source. Since , visual c++ doesn't work in linux, I need to find out some alternatives.

So, please me what all alternatives I have

Thanks for your valuable time..!!


i need to run that code in linux so that i can make it an open source.

No, you can license code as open source without it running on linux. If you simply want your code to run under linux you need to learn how to port from VC++ to Linux/GNU. It's not simply a matter of re compiling it.

See the following URL for advice and google search for more if required: http://www.johndcook.com/blog/2008/05/29/porting-visual-c-code-to-linuxgcc/


In my experience you can get a looooong way with

http://www.winehq.org/docs/winelib-guide/winelib-toolkit

  • winemaker (doing things as making all your includes case-sensitive correct on Linux)
  • winegcc (linking to the winelib runtime libs so you can have _WinMain and stuff like that just work)

Of course there are libraries that simply don't exist. Also, installing an SDK can be daunting; winetricks.sh is very helpful in that department. Also, you can consider 'XCOPY' deploying the SDK into your linux build tree and working with that;

This has successfully let me cross compile MSVC projects linked with 3rd party windows libraries in the past. Note minor incompatibilities due to having slightly different linkage semantics with gcc/GNU ld by default; expect this to affect areas like RTTI and exceptions thrown across DLL boundaries).

YMMV

Edit I want to confirm the fact that you can have perfectly valid opensource code for windows only, and you can build it using Visual Studio too. If you want to be nice to your (prospective) contributors, make sure you only depend on Visual Studio Express C++ (not MFC, e.g.) but hey, that's really up to you!


which is a sort of GUI used in virtual com PORT connection

This will be probably hardly portable (because of the BIG differences how virtual ports and GUI are handled in linux and windows - unless you used some cross-platform library already in Windows).

You can release your code as OpenSource for Windows only.

0

精彩评论

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