CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28

Thread: STL and Linux

  1. #16
    Join Date
    Jan 2004
    Posts
    20
    Originally posted by kasracer
    You do realize that proves my point, right? It shows that f() means the samething as f(void).
    let me spell it out then. you said:
    Originally posted by kasracer
    Do not pass void to functions in C++.
    ...
    Because the C++ standard says NOT to.
    and you were wrong - there's no such interdiction in the C++ standard.

    Originally posted by kasracer
    Besides, when I did a search for 8.3.5.1 I didn't find ANYTHING, but in the standard in 8.3.5 it mentions restricts the use of void as parameter type
    My bad - the quote I gave was from Appendix C (C1.6 Clause 8: Declarators). However, you seem to have read 8.3.5 incompletely, since it explicitly says (again) that (void) is equivalent to (). The reason is this is an incompatibility with the C standard where () means no parameter specification. I presume you were referring to the following from 8.3.5.2 (your quote is not verbatim):

    If the parameter-declaration-clause is empty, the function takes no arguments. The parameter list (void) is equivalent to the empty parameter list. Except for this special case, void shall not be a parameter type (though types derived from void, such as void*, can).
    so yes, it's restricted EXCEPT for this case.

    Originally posted by kasracer
    I don't even know why you would top this thread now, it's a bit late.
    if you check the thread, nobody had previously corrected the original poster's mistake about confusing iostream objects (in particular cout) with STL objects. second, nobody corrected your assertion about (void) being forbidden. It's only longer to write than (). Some people actually prefer to put it explicitly when they deal with both C and C++ code just to avoid confusions.
    Given that the thread was in a 'forum highlights' issue, uncorrected mistakes after such a long time can damaging. Speaking of which, the reccomended use of STLport is overkill. g++ has a complete implementation of STL, no need to download a different one unless there's some obscure implementation incompatibility that one wants to avoid when moving between platforms.

  2. #17
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by abc_coder
    to use C++ standard objects you need to link against the implementing library
    How is that done for VC? I am not aware of doing that for VC. If I need to do it for VC then I don't know how it is done and I don't know how it is possible to not do it.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  3. #18
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443
    Back to the OP's question. I have limited experience with Linux, but when I need to use a certain STL implementation I pass the path of the headers to the compiler using (if my memory serves me right) the -I option, like
    Code:
    gcc -I path_to_stl file.cpp file.o
    There probably are more option switches in that command, I'm just illustrating.

    HTH,
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  4. #19
    Join Date
    Dec 2003
    Posts
    220
    Originally posted by Sam Hobbs
    How is that done for VC? I am not aware of doing that for VC. If I need to do it for VC then I don't know how it is done and I don't know how it is possible to not do it.
    But the OP and what abc_coder is talking about has nothing related to VC.
    That s just a thought...

    Regardlessly,
    Homestead

  5. #20
    Join Date
    Jan 2004
    Posts
    20
    Originally posted by Gabriel Fleseriu
    Back to the OP's question. I have limited experience with Linux, but when I need to use a certain STL implementation I pass the path of the headers to the compiler using (if my memory serves me right) the -I option, like
    Code:
    gcc -I path_to_stl file.cpp file.o
    There probably are more option switches in that command, I'm just illustrating.
    HTH,
    the compiler will usually have a list of standard search paths; same goes for the linker. in particular, in Lunix g++ (the c++ compiler) will add to the standard include search path (/usr/include) the path to where its c++ headers are installed (usually /usr/include/c++/x.y.x/ where x.y.z is the g++ version). thus if you're using the compiler's version of the library no header path is required, otherwise (or if using the generic gcc frontend) use the -I switch. same goes for the stdc++ library: g++ links it automatically, while gcc needs an explicit mention.

    Originally posted by Sam Hobbs
    How is that done for VC? I am not aware of doing that for VC.
    VC does it automatically for you (depending on what type of project you selected). check for instance the project's linker options for the list of libraries that it's linking against.

  6. #21
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by Homestead
    But the OP and what abc_coder is talking about has nothing related to VC.
    It definitely is related to VC. VC implements the standard, and the comment I replied to said "to use C++ standard objects you need to link against the implementing library". That comment said "C++ standard", therefore VC is relevant. I know that this is the non-VC forum, but unless that statement is relevant to all compilers except VC, then VC is an example that applies to the other relevant compilers.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  7. #22
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by Gabriel Fleseriu
    Back to the OP's question. I have limited experience with Linux, but when I need to use a certain STL implementation I pass the path of the headers to the compiler using (if my memory serves me right) the -I option, like
    Code:
    gcc -I path_to_stl file.cpp file.o
    There probably are more option switches in that command, I'm just illustrating.

    HTH,
    The original question asks about a linker error, implying that there is not a problem compiling, implying tat there is not a problem with the compiler finding the path of the headers.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  8. #23
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by abc_coder
    VC does it automatically for you (depending on what type of project you selected). check for instance the project's linker options for the list of libraries that it's linking against.
    There is nothing linked for the STL by VC. All of the STL is implemented in the headers. Since VC uses the Dinkumware implementation (right?) this would apply to other compilers (the ones that use the Dinkumware implementation) and all users of the Dinkumware implementation (since it can be purchased separately from a compiler).
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  9. #24
    Join Date
    Jan 2004
    Posts
    20
    Originally posted by Sam Hobbs
    It definitely is related to VC. VC implements the standard, and the comment I replied to said "to use C++ standard objects you need to link against the implementing library".
    I apologize for the imprecision - that was referring to precompiled objects/classes that need to be linked in (the OP had a linking problem due to cout). As you already said, STL resides usually only in headers (there can be exceptions of custom non-template parts that are compiled in by some implementations).

    the point was the OP's (total?! ) confusion about what STL is:
    I tried to use the iostream template class in the STL library
    peace!

  10. #25
    Join Date
    Dec 2003
    Posts
    220
    Is it true that VC uses the Dinkumware implementation ?
    How do people know that ? Where can I find a specification to let me know that ?

    Thanks

    BestRegards,

    homestead

  11. #26
    Join Date
    Dec 2003
    Posts
    220
    It s really hard to get any help ?

    Regards,
    homestead

  12. #27
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by Homestead
    Is it true that VC uses the Dinkumware implementation ?
    Although this is being off-topic for this thread...yes, VC uses the Dinkumware STL implementation by default...

  13. #28
    Join Date
    Dec 2003
    Posts
    220
    Originally posted by Andreas Masur
    Although this is being off-topic for this thread...yes, VC uses the Dinkumware STL implementation by default...
    I asked so because it is written in Sam's post...I didnt quote his post.
    But thanks alot for your answer.

    Regards,
    homestead

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured