|
-
November 17th, 2006, 02:57 PM
#16
Re: getting a new compiler....
i think i have figures out my issues...
-
November 17th, 2006, 03:00 PM
#17
Re: getting a new compiler....
 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.
-
November 18th, 2006, 12:55 PM
#18
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
-
November 18th, 2006, 01:32 PM
#19
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?
-
November 18th, 2006, 01:33 PM
#20
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
-
November 18th, 2006, 04:28 PM
#21
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.
-
November 18th, 2006, 04:36 PM
#22
Re: getting a new compiler....
 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
-
November 20th, 2006, 05:57 AM
#23
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
-
November 20th, 2006, 09:27 AM
#24
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.
-
November 21st, 2006, 01:37 AM
#25
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...
-
November 21st, 2006, 01:58 AM
#26
Re: getting a new compiler....
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
November 27th, 2006, 03:15 AM
#27
Re: getting a new compiler....
 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.
-
November 27th, 2006, 01:51 PM
#28
Re: getting a new compiler....
 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
-
November 27th, 2006, 01:59 PM
#29
Re: getting a new compiler....
 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
-
November 27th, 2006, 05:29 PM
#30
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|