Can a single eclipse C++ project link different libraries differently for different platforms?

I have a C++ eclipse project that I would like to easily compile In Windows and OSX.

The project is currently using an automatically generated makefile.

The libraries that I need vary depending on the platform.

In osx I'm using the CoreMidi, CoreAudio, and CoreFoundation frameworks. In Windows I'm using the winmm.lib and multithreaded libraries.

What's the simplest way to link different libraries/frameworks depending on the current platform?

I'm currently using the gcc toolchain on OSX. Should I start using the cross compile toolchain?

Should I have two projects. One for working in windows, and one for osx, checking them both in to version control?

Should I write a custom makefile instead of using the automatically generated option that has different g++ arguments depending on the platform?


I personally had the same goal for a project and came to the conclusion the Qt framework was the best thing for me. It handles multiple languages, unicode strings, XML, network communications, native looking user interfaces, console applications: it can do an AWFUL lot.

However, as Paul pointed out, you really have to plan it from the start.

Qt does a good job of abstracting the platform away (in a module called QtCore) allowing you to write vanilla C++ code, or you can chose to include some Qt C++ language extensions which a Qt helper application called the moc (meta object compiler) creates vanilla C++ from, which can then be compiled by most common C++ compilers.

It also has a nifty cross-platform makefile generator called qmake which works on project files to create normal make files for the platform its running on.

Off the top of my head at least Windows XP & 7, OSX 10.4, 10.5, 10.6 are supported currently. But note that OSX Lion is (as of writing) not officially supported but I suspect it will be in the next release.

Need Your Help

Resursive function calling in user created smarty functions in smarty plugin directory

php plugins recursion smarty user-defined-functions

I am trying to write a smarty function inside smarty plugin directory. It is a recursive function . It is working well in normal php files and will generate a drop down select box. Now I would like...

Mobile Chrome for iOS: tel-anchors buggy?

html ios google-chrome mobile mobile-safari

I have a problem with opening links for telephone numbers in mobile Chrome for iOS. If you open the test-page ( on your mobile phone it works all fine on ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.