Fedora Linux Support Community & Resources Center
  #1  
Old 10th November 2005, 02:44 AM
darkscript's Avatar
darkscript Offline
Registered User
 
Join Date: Nov 2005
Location: Georgia
Age: 25
Posts: 92
Question C++ Library Question

I've come from developing programms in c++ on the windows box. I'm not used to the structure and layout of the STL and I feel greatly more comfortable with <iostream> <fstream>. I've been using them blindly since all of my programming books refer to them instead of the STL. So I dont even know if there platform dependent. Heck they could even be part of the STL.

So, what I want to know is,

Can I use this library on linux?
Reply With Quote
  #2  
Old 10th November 2005, 11:13 AM
Spoon! Offline
Registered User
 
Join Date: Aug 2005
Location: Hell
Posts: 758
The Standard Template Library (STL) is part of the C++ standard, so all implementations of C++ should support them. It includes stuff like templated containers ("vector", "list", "set", etc.), their iterators, algorithms and utilities that are used on those containers (sort, copy,etc.) , templated function objects and their associated stuff, etc. The classes in the STL are templated, meaning that they must be specialized for some specific type -- i.e. list<int>. The iostream library and the standard C library are not part of the STL since they do not involve templated types.

For a very technical reference of the STL, go here; for a simple reference of the classes, go here.
Reply With Quote
  #3  
Old 10th November 2005, 10:28 PM
darth_vector Offline
Registered User
 
Join Date: Oct 2005
Posts: 13
yes, you can use iostream and fstream in linux
Reply With Quote
  #4  
Old 25th November 2005, 03:45 AM
guyverlord3 Offline
Registered User
 
Join Date: Jan 2005
Posts: 15
<iostream> does a few thing, the main the is cin and cout that is all, but yerah it is standard build when I make a program, but so is string
__________________
FONT=Comic Sans MS
"Mess with the best die like the Rest"
Reply With Quote
  #5  
Old 26th November 2005, 03:27 AM
darkscript's Avatar
darkscript Offline
Registered User
 
Join Date: Nov 2005
Location: Georgia
Age: 25
Posts: 92
Arrow

So now that I know that this library is compatible with linux, How can I get it to work with gcc? In otherwords where do I put the header files and what configuration files must I change.

Last edited by darkscript; 26th November 2005 at 03:32 AM. Reason: Edited the question for a more pointed response
Reply With Quote
  #6  
Old 26th November 2005, 06:12 AM
Spoon! Offline
Registered User
 
Join Date: Aug 2005
Location: Hell
Posts: 758
Quote:
Originally Posted by darkscript
So now that I know that this library is compatible with linux, How can I get it to work with gcc? In otherwords where do I put the header files and what configuration files must I change.
You don't need to change anything. This is standard C++. Just put #include <iostream> or whatever; and any C++ compiler (especially GCC-C++) should have all the headers and be able to compile it without any extra action.
Reply With Quote
  #7  
Old 5th May 2006, 10:55 AM
Livid Offline
Registered User
 
Join Date: Oct 2005
Posts: 24
Hi,

It's been some while since the last post here. But I'm also trying to use the stl library on fedore (FC4). But just doing the following small test doesn't work:
Quote:
#include <iostream>
#include <string>
using namespace std;
int main(){
string naam;
cout << "Geef je naam op: ";
cin >> naam;
cout << endl << "Je naam was: " << naam;
exit 0;
}
the output I get when compiling with gcc is:

Quote:
[root@localhost Algoritmen]# gcc stl_test.c -o stl_test
stl_test.c:1:20: error: iostream: No such file or directory
stl_test.c:2:18: error: string: No such file or directory
stl_test.c:3: error: syntax error before ‘namespace’
stl_test.c:3: warning: data definition has no type or storage class
stl_test.c: In function ‘main’:
stl_test.c:5: error: ‘string’ undeclared (first use in this function)
stl_test.c:5: error: (Each undeclared identifier is reported only once
stl_test.c:5: error: for each function it appears in.)
stl_test.c:5: error: syntax error before ‘naam’
stl_test.c:6: error: ‘cout’ undeclared (first use in this function)
stl_test.c:7: error: ‘cin’ undeclared (first use in this function)
stl_test.c:7: error: ‘naam’ undeclared (first use in this function)
stl_test.c:8: error: ‘endl’ undeclared (first use in this function)
stl_test.c:9: warning: incompatible implicit declaration of built-in function ‘exit’
[root@localhost Algoritmen]
So it does not seem to me like stl is standaard installed :s. I have downloaded the stl and placed it in the subfolder stl_lib. Does anyone know how I have to compile my files so that gcc knows how to check in this directory for the stl header files?

thanks in advance
Reply With Quote
  #8  
Old 5th May 2006, 10:57 AM
Spoon! Offline
Registered User
 
Join Date: Aug 2005
Location: Hell
Posts: 758
Quote:
Originally Posted by Livid
Hi,

It's been some while since the last post here. But I'm also trying to use the stl library on fedore (FC4). But just doing the following small test doesn't work:


the output I get when compiling with gcc is:



So it does not seem to me like stl is standaard installed :s. I have downloaded the stl and placed it in the subfolder stl_lib. Does anyone know how I have to compile my files so that gcc knows how to check in this directory for the stl header files?

thanks in advance
For C++, you should give your files ".cpp" extension and use g++ instead of "gcc"
Reply With Quote
  #9  
Old 5th May 2006, 11:00 AM
Livid Offline
Registered User
 
Join Date: Oct 2005
Posts: 24
Ah! thanks alot :-)
Reply With Quote
  #10  
Old 6th May 2006, 02:12 AM
darkscript's Avatar
darkscript Offline
Registered User
 
Join Date: Nov 2005
Location: Georgia
Age: 25
Posts: 92
I wish they would port dev c++ for us. that would be a great tool. I know its out now, but it uses the qt library.
Reply With Quote
  #11  
Old 6th May 2006, 03:03 AM
pete_1967 Online
Clueless in a Cuckooland
 
Join Date: Mar 2006
Location: Here now, elsewhere tomorrow.
Posts: 3,928
Try Anjuta if you are shy to use QT libraries, if not, KDevelop is another great GUI, not forgetting Eclipse with C/C++ plugin.
Reply With Quote
Reply

Tags
library, question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Library Question cable_txg Programming & Packaging 4 8th June 2008 12:45 PM
Question on thread library on Fedora 3 sathya Using Fedora 1 4th September 2007 06:58 AM
[Question] How to let yum know about installed library? configer Using Fedora 2 31st July 2006 07:55 PM
Legal Question: Can a public library 'borrow' the design of the FC website? AlexV Programming & Packaging 13 22nd February 2005 06:33 AM
Question on Icon library rgm1960 Programming & Packaging 5 21st July 2004 07:31 AM


Current GMT-time: 12:21 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat