473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0

hi,

i've some troubles compiling Bjarne Strostrup's Matrix class example

http://www.research.att.com/~bs/matrix.c

under ms visual c++ 6.0 (sp4). i get a lot off errors like

matrix_klasse_by_stroustup.cxx(37) : error C2143: Syntaxfehler :
Missing ';' before '<'

for code like

friend bool operator==<>(const Slice_iter& p, const Slice_iter& q);

-- 60 errors in total --
when i compile it on linux (with gcc 3.3) or on sgi everything is fine
and with intel c++ (win) i get only 3 errors for redefining a variable
(which seems to be right?!) and after removing this it is also fine.

do i miss a compiler flag or is there a general problem with ms vc++
6.0 (and if so is it also present in version 7.0)

kind regards

peter

------------------------------------------------------------------------
p.s: compiler flags:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no
/pdb:"Release/simple_tests.pdb" /machine:I386
/out:"Release/simple_tests.exe"
Jul 19 '05 #1
4 4275
"Peter _Grafenberger" <pe****************@vatech-hydro.at> wrote...
i've some troubles compiling Bjarne Strostrup's Matrix class example
[...]
do i miss a compiler flag or is there a general problem with ms vc++
6.0 (and if so is it also present in version 7.0)


This is a PERFECT question to ask in microsoft.public.vc.language.
Please post any compiler-specific questions to a newsgroup for that
compiler.

Victor
Jul 19 '05 #2
Ron Natalie wrote:
Don't call it matrix.c. Most C++ compilers will treat files that end in
.c as the C language.


Actually, he didn't name it *.c:
matrix_klasse_by_stroustup.cxx(37) : error C2143: Syntaxfehler :
Missing ';' before '<'
--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.

Jul 19 '05 #3

"Peter _Grafenberger" <pe****************@vatech-hydro.at> wrote in message
news:48**************************@posting.google.c om...

friend bool operator==<>(const Slice_iter& p, const Slice_iter& q);

-- 60 errors in total --
when i compile it on linux (with gcc 3.3) or on sgi everything is fine
and with intel c++ (win) i get only 3 errors for redefining a variable
(which seems to be right?!) and after removing this it is also fine.

do i miss a compiler flag or is there a general problem with ms vc++
6.0 (and if so is it also present in version 7.0)


MSVC6 is notoriously bad at template code. Off the top of my head, partial
specialization and template member functions are both not supported, and
complicated templates tend to increase the likelihood of an internal
compiler error. I haven't used 7, so I don't know if it works any better.
I recommend using anything other than 6 if you have any choice in the
matter.
Jul 19 '05 #4
In article <48**************************@posting.google.com >,
Peter _Grafenberger <pe****************@vatech-hydro.at> wrote:
hi,

i've some troubles compiling Bjarne Strostrup's Matrix class example

http://www.research.att.com/~bs/matrix.c

under ms visual c++ 6.0 (sp4). i get a lot off errors like

matrix_klasse_by_stroustup.cxx(37) : error C2143: Syntaxfehler :
Missing ';' before '<'

for code like

friend bool operator==<>(const Slice_iter& p, const Slice_iter& q);


Remove the "<>"'s on the various operator members, fix the for
scoping issues, and this compiles and appears to execute just fine
under VC++6.0 and VC++7.0. (Modulo compiler whine level.)

Before I get flamed for mentioning compiler specific matters, is
this really the correct friend declaration? What were the design
decisions behind not using something like

template<> friend operator==(const Slice_iter& p, const Slice_iter& q);

instead? I'm sure Stroustrup is right, but it just looks wrong.
Some idiot (ok, me) might think that there is a C++ operator called
"==<>", instead of realizing that operator== is a template function.
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
5
by: PengYu.UT | last post by:
Hi, I heard that debug some C++ templates is very difficult. I'm wondering whether it is possible to compile C++ program with templates to pure C or C++ program without templates? Best...
3
by: | last post by:
I am trying to compile a simple c# class in Web Matrix called howdy.cs: // Program start class public class HowdyPartner { // Main begins program execution public static void Main() { //...
2
by: Carl | last post by:
Since we are going to develop a system in a workgroup only or in samll project. Is it advisable to use only Web Matrix instead of using VS.NET? Although some features of VS.NET was not available on...
4
by: needin4mation | last post by:
I work in Visual Studio, but not everyone where I am at does. Sometimes, however, they may have to make minor adjustments here and there. Since the code is c#, behindform code, if they make an...
2
by: Frédéric Degraeve | last post by:
Hello, My compiler is visual 7.1 ( Microsoft Visual C++ .NET ). I work on a c++ library for a big company which do many scientific computes. I want to integrate lapack++ inside the library by...
10
by: Ing. Carlos Villaseñor M. | last post by:
Hi everybody! I have developed in C# and got in a news group a math class that make matrix operations, eigenvals, eigenvecs, stat functions and much more, but now I trying to develop software in...
2
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the...
2
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.