Jump to content
  • Advertisement
Sign in to follow this  
Xues32

from windows to linux

This topic is 4080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have write a program in VS2005 and now i want to compile on linux. How i can make Makefile and configure? TNX

Share this post


Link to post
Share on other sites
Advertisement
Check out SCons or CMake. Two great tools for cross platform development building. Much more joyfull to work with than autotools... :-) Just my opinion tho.

christer

Share this post


Link to post
Share on other sites
Quote:
Original post by Xues32
I have write a program in VS2005 and now i want to compile on linux.
How i can make Makefile and configure?


I have yet to see a useful tool that will convert any of the several mutually-incompatible MSVC project files into a useful Makefile, let alone an autotools-compatible project.

You best bet is probably to learn one of the cross-platform build tools (there are many, some are better than others, google for them) and stick with that either for all-builds-but-Windows or else for all builds, using MSVC simply as a text editor. Many of the cross-platform tools will integrate the Microsoft C++ toolchain so you don't have to switch compilers.

If you want the classic GNU-style configure/make you'll need to use the GNU autotools. They have the distinct advantage that once ported to autotools, your project will build for any platform. No other build tool has that feature. No other build tool has the broad selection of arcane configuration languages and steep learning curve to get productive, either. It's a tradeoff, and you have to decide what you really want and what you're willing to pay for.

--smw

Share this post


Link to post
Share on other sites
To write a makefile, you have to understand a few things about the GCC/G++ compiler, specifically how to include libraries, includes, and set arguments. Makefiles are essentially glorified shell scripts. You can read more about them at the wiki: http://en.wikipedia.org/wiki/Make

Some important arguments you'll need in your makefile:

-c = compile file/class
-o <arg> = output to
-l<LIB> = use library
-I<SRC> = Include source/header directory
-wall = debug
$@ = Variable marker for the current make argument
$^ = Variable marker for arguments after the ':'

For example, let's compile/link the main.cpp of a project. To set this up, the first line for our given argument is:

main.o : /source/path/main.cpp
g++ -wall -I/path/to/include $^ -c -o $@

Now, to link the executable in g++:

all : main.o
g++ -I/path/to/include -o app $^ -l/path/to/lib1 -l/path/to/lib2

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!