Solved

GCC and Visual C++...

Posted on 1999-01-11
5
224 Views
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?

Thanks...
0
Comment
Question by:loyaliser
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:yonat
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

0
 
LVL 1

Author Comment

by:loyaliser
ID: 1181875
Cool... you can have the points.
0
 

Expert Comment

by:ahTri
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.
0
 
LVL 5

Accepted Solution

by:
yonat earned 20 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/
 .
0
 
LVL 1

Author Comment

by:loyaliser
ID: 1181878
Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now