Solved

GCC and Visual C++...

Posted on 1999-01-11
5
218 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 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

12 Experts available now in Live!

Get 1:1 Help Now