Solved

GCC and Visual C++...

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ finding a sting in a char* string from a text file 3 110
Create a path if not exists 7 78
Online file editor, manager 6 76
Precision Problem in C++ 7 33
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

823 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