GCC and Visual C++...

Posted on 1999-01-11
Medium Priority
Last Modified: 2013-12-14
I am writing various basic programs (sorting algorithms, trees, lists etc.) in MS Visual C++ 6.0 and need to have them compile with the GNU GCC compiler (version 2.7) of UNIX.

Are there any issues I should be aware of? Any tools that make this easy?

Question by:loyaliser
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 1181874
Advice no. 1 would be to stick to the standard C++, and not use any Windows specific stuff. (don't #include <windows.h>, don't use stuff like __declspec etc.)

Advice no.2, however, would be to use the standard library instead of writing your own classes - it already has sorting algorithms, lists, a binary  tree and more. For more info see http://www.research.att.com/~bs/3rd_tour2.pdf, or the following:
* http://www.sgi.com/Technology/STL/stl_introduction.html
* http://www.objectplace.com/technology/articles/9508.shtml
* http://www.eckelobjects.com/stlsimpl.html
* http://www.yrl.co.uk/~phil/stl/stl.htmlx
* http://www.cs.brown.edu/people/jak/programming/stl-tutorial/tutorial.html
* http://www.infosys.tuwien.ac.at/Research/Component/tutorial/prwmain.htm
* http://web.ftech.net/~honeyg/articles/eff_stl.htm


Author Comment

ID: 1181875
Cool... you can have the points.

Expert Comment

ID: 1181876
beware of the library, especially vector.h is not the same in different compiler (maybe because of the old version)

using namespace std;
this statement dont always work with gcc

the list, algorithm is available but if u are pratising, do it because those library or class provided has lots of redundant functions ( a tree fall in an inhabbited forrest -> it doesnt make a sound)

using iostream and stdio.h : the results may be unpredictable.

Accepted Solution

yonat earned 80 total points
ID: 1181877
loyaliser, thanks for the points.

ahTri, I do not understand your comments about the STL. You can definitely use it with gcc. There is a very nice portable (and free) version at http://www.metabyte.com/~fbp/stl/

Author Comment

ID: 1181878

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question