CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: getting a new compiler....

    i think i have figures out my issues...

  2. #17
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: getting a new compiler....

    Quote Originally Posted by Mitsukai
    that is the problem i dont have visual studio .. i have vc++ express
    I use the full version at work and express at home. They are both fine.
    My hobby projects:
    www.rclsoftware.org.uk

  3. #18
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: getting a new compiler....

    hey. can you please try this code in both versions:

    Code:
    	template<class t_Security>
    		struct ObjHeap
    		{
    			typedef t_Security	Security;
    
    			template<class t_Heap = ObjHeap<Security> >
    			struct BaseTrait
    			{
    				struct Copy
    				{
    				} static Copy;
    			}; typedef BaseTrait<> Trait;
    		};
    
    		template<class t_Security>
    template <class t_Heap>
    		struct ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy;

    and tell me if u get error.



    what about solaris? in the add, i think i might change to solaris... is this a unix system like linux? it also says they have package with compiler

  4. #19
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: getting a new compiler....

    Code:
    template<class t_Security>
    template <class t_Heap>
    struct ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy;
    What are you trying to do there?
    My hobby projects:
    www.rclsoftware.org.uk

  5. #20
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: getting a new compiler....

    just try to compile it on the pro version.
    express version gives error.

    works with comeau and probably all the other compilers

  6. #21
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: getting a new compiler....

    Can't use the pro version until Monday, but I'm certain that express and pro use the same command line compiler exe.
    My hobby projects:
    www.rclsoftware.org.uk

  7. #22
    Join Date
    Sep 2005
    Location
    United States
    Posts
    799

    Re: getting a new compiler....

    Quote Originally Posted by Mitsukai
    what about solaris? in the add, i think i might change to solaris... is this a unix system like linux?
    Yes, Solaris is a Unix based operating system made by Sun Microsystems.

    It has a GUI and console capabilities just like many Linux distributions, although IMO the Linux GUI's are much better
    Please rate my post if you felt it was helpful

  8. #23
    Join Date
    Jun 2006
    Location
    Dundee, United Kingdom
    Posts
    22

    Re: getting a new compiler....

    I've always been quite happy with MinGW (a windows native port of g++). It seems to be quite standards-compliant.

    I develop code in MinGW in Windows, and generally have zero problems recompiling on VC++ in Windows, g++ or Intel's icc in Linux, or g++ on Solaris and Unix. I can't say the same for VC++ or Borland (particularly Borland).

    This portability has been a godsend for me: I can develop my scientific computations in the comfort of Windows, and run them on powerful Linux clusters. And I can collaborate with scientists regardless of whether they use Windows or Linux (or Mac, etc.) -- Paul
    Paul Macklin
    Lecturer in computational/applied mathematics at the University of Dundee
    Research: Mathematical Cancer Modelling and Simulation

    Developer for EasyBMP (cross-platform C++ BMP library)
    Developer for EasyBMPtoAVI (cross-platform BMP to AVI converter)
    Moderator at the overclockers forums (ocforums.com)

  9. #24
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    Re: getting a new compiler....

    i use codeblocks and dev-c++ now(both g++), so i can check for portable code
    Last edited by Mitsukai; November 20th, 2006 at 10:50 AM.

  10. #25
    Join Date
    Nov 2006
    Posts
    24

    Re: getting a new compiler....

    can some one please upload or link me so that i can downloag either Min GW or g++, cant seem to find the exe file for windows on their site...

  11. #26
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

  12. #27
    Join Date
    Jun 2006
    Location
    Dundee, United Kingdom
    Posts
    22

    Re: getting a new compiler....

    Quote Originally Posted by krayziehustler
    can some one please upload or link me so that i can downloag either Min GW or g++, cant seem to find the exe file for windows on their site...
    Sorry!

    Their site is definitely a little confusing. Here's the scoop:

    1) A complete MinGW (not runtime) package:

    http://prdownloads.sf.net/mingw/MinG...2.exe?download

    I've been using the 5.0.2 package without any problems.

    2) MSYS (a minimal sys type of thing, and handy, particularly for patching):

    http://prdownloads.sf.net/mingw/MSYS...0.exe?download

    Knowing which MinGW download to use has been a bit of a trick. Hopefully, this will help out. Thanks, and good luck!! -- Paul

    *edit*
    Evidently, the www.sourceforge.net/projects/mingw site is better updated than the www.mingw.org site. There's a slightly newer version here:

    http://downloads.sourceforge.net/min...use_mirror=umn

    http://downloads.sourceforge.net/min...se_mirror=osdn

    -- Paul
    */edit*
    Last edited by macklin01; November 27th, 2006 at 03:17 AM.
    Paul Macklin
    Lecturer in computational/applied mathematics at the University of Dundee
    Research: Mathematical Cancer Modelling and Simulation

    Developer for EasyBMP (cross-platform C++ BMP library)
    Developer for EasyBMPtoAVI (cross-platform BMP to AVI converter)
    Moderator at the overclockers forums (ocforums.com)

  13. #28
    Join Date
    Nov 2002
    Location
    Foggy California
    Posts
    1,245

    Re: getting a new compiler....

    Quote Originally Posted by Mitsukai
    hey. can you please try this code in both versions:

    and tell me if u get error.
    Yes, visual studio 2005 (Professional) reports errors:

    Code:
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : error C2065: 't_Heap' : undeclared identifier
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : error C2955: 'ObjHeap<t_Security>::BaseTrait' : use of class template requires template argument list
            c:\test\codegurutest\codegurutest\codegurutest.cpp(12) : see declaration of 'ObjHeap<t_Security>::BaseTrait'
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : error C2143: syntax error : missing ';' before 'ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy'
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : error C3858: 'ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy': cannot be redeclared in current scope
            c:\test\codegurutest\codegurutest\codegurutest.cpp(10) : see declaration of 'ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy'
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : warning C4356: 'ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy' : static data member cannot be initialized via derived class
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\test\codegurutest\codegurutest\codegurutest.cpp(17) : error C2371: 'Copy' : redefinition; different basic types
            c:\test\codegurutest\codegurutest\codegurutest.cpp(11) : see declaration of 'Copy'
    Comeau, does compile this, but produces a warning:
    Code:
    Comeau C/C++ 4.3.8 (Aug 19 2006 13:36:48) for  ONLINE_EVALUATION_Alpha1
    Copyright 1988-2006 Comeau Computing.  All rights reserved.
    MODE:strict errors C++
    
    "ComeauTest.c", line 11: warning: storage class is not first
      		} static Copy;
      		  ^
    The problem with Visual studio is that it does not allow the template instatiation of the static variables (the code Zacchaeus is asking about). If you replace that code with the following:

    Code:
    struct ObjHeap<int>::BaseTrait<long>::Copy ObjHeap<int>::BaseTrait<long>::Copy;
    then Visual Studio will compile with no errors and no warnings.

    It's difficult for a compiler to know what static variables to instantiate a priori. Personally, I would not be surprised to find that most compilers that do not support export do not support the template instantiations of static variables. (I would particularly be interested if g++ compiled Mitsukai's original code)

    Mitsukai, please note, that there are very, very few 100% ISO compliant C++ compilers around. Most popular compilers do not support export. I also understand there are esoteric corners of the language that many compilers don't bother to conform to (though I don't know what they are offhand). Visual C++ 2003 and 2005 are considered to be excellent in levels of compliance and generally speaking do not prevent people from writing effective code. (For reference, Dikumware has the only 100% compliant TR1 library and it is fully functional on Visual Studio versions 2003 and 2005 [i.e. versions 7.1 and 8.0 respectively]).
    Kevin Hall

  14. #29
    Join Date
    Nov 2002
    Location
    Foggy California
    Posts
    1,245

    Re: getting a new compiler....

    Quote Originally Posted by KevinHall
    Mitsukai, please note, that there are very, very few 100% ISO compliant C++ compilers around. Most popular compilers do not support export.
    Also note that g++ is not 100% ISO compliant.

    As for 100% compliant compilers, I only know of Comeau (which generates C code and requires a C compiler back-end). Intel C++ 9.1 claims 100% compliance (though I have not seen this verified by independent sources).
    Kevin Hall

  15. #30
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: getting a new compiler....

    This was resolved in another thread:

    http://www.codeguru.com/forum/showth...28#post1493428

    I renamed the Copy type to CopyT and replaced the 'struct' keyword with 'typename'.

    Code:
    template<class t_Security>
    struct ObjHeap
    {
    	typedef t_Security	Security;
    
    	template<class t_Heap = ObjHeap<Security> >
    	struct BaseTrait
    	{
    		struct CopyT
    		{
    		} static Copy;
    	}; typedef BaseTrait<> Trait;
    };
    
    template<class t_Security>
    template <class t_Heap>
    typename ObjHeap<t_Security>::BaseTrait<t_Heap>::CopyT ObjHeap<t_Security>::BaseTrait<t_Heap>::Copy;
    This compiles in VC++2005.
    My hobby projects:
    www.rclsoftware.org.uk

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