The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy -Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
it displays the following errors:
kk.cpp: In function `void Burp(std::ostre am&,
std::vector<std ::vector<T, std::allocator< _CharT,
std::allocator< std::vector<T, std::allocator< _CharT &)':
kk.cpp:15: error: expected `;' before "ite"
kk.cpp:15: error: `ite' undeclared (first use this function)
kk.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Any help is appreciated, Thanks.
CODE:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T& vec)
{
os << "Our vector of vectors" << endl;
for(vector< vector<T::itera tor ite = vec.begin(); ite!=
vec.end();ite++ )
{
copy((*ite).beg in(), (*ite).end(), ostream_iterato r<T>(os, " "));
os << endl;
}
os << "/Our vector of vectors" << endl;
} 6 3632
On 2008-10-18 21:48, JR wrote:
The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy -Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
it displays the following errors:
kk.cpp: In function `void Burp(std::ostre am&,
std::vector<std ::vector<T, std::allocator< _CharT,
std::allocator< std::vector<T, std::allocator< _CharT &)':
kk.cpp:15: error: expected `;' before "ite"
kk.cpp:15: error: `ite' undeclared (first use this function)
kk.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Any help is appreciated, Thanks.
CODE:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T& vec)
{
os << "Our vector of vectors" << endl;
for(vector< vector<T::itera tor ite = vec.begin(); ite!=
I can't see anything wrong on the 15th line (the above is the 13th) but
try using
for (typename vector< vector<T::itera tor ite = ...
--
Erik Wikström
On Oct 18, 1:05*pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2008-10-18 21:48, JR wrote:
The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
*g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy *-Wold-style-cast-
Woverloaded-virtual -o kk kk.cpp
it displays the following errors:
kk.cpp: In function `void Burp(std::ostre am&,
std::vector<std ::vector<T, std::allocator< _CharT,
std::allocator< std::vector<T, std::allocator< _CharT &)':
kk.cpp:15: error: expected `;' before "ite"
kk.cpp:15: error: `ite' undeclared (first use this function)
kk.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Any help is appreciated, Thanks.
CODE:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T& vec)
{
* *os << "Our vector of vectors" << endl;
* *for(vector< vector<T::itera tor ite = vec.begin(); ite!=
I can't see anything wrong on the 15th line (the above is the 13th) but
try using
* for (typename vector< vector<T::itera tor ite = ...
--
Erik Wikström
Hi Erik, and many thanks for your input.
Two things:
- How did you figure out that by adding "typename" the error would
go?...by the way the error message is not appearing anymore...
-...however, now I am getting the following error (it looks like it
came from a deeper part of the compiling process):
$ g++ -Weffc++ -Wall -Wctor-dtor-privacy -Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(lib cmain.o):
(.text+0xab): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
Does anybody know if the compiler g++ 3.4.4 is broken?
Thanks again in advance. JR
On 18 Okt., 22:51, JR <mr.riv...@yaho o.comwrote:
On Oct 18, 1:05*pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2008-10-18 21:48, JR wrote:
The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
*g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy *-Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
it displays the following errors:
kk.cpp: In function `void Burp(std::ostre am&,
std::vector<std ::vector<T, std::allocator< _CharT,
std::allocator< std::vector<T, std::allocator< _CharT &)':
kk.cpp:15: error: expected `;' before "ite"
kk.cpp:15: error: `ite' undeclared (first use this function)
kk.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Any help is appreciated, Thanks.
CODE:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T& vec)
{
* *os << "Our vector of vectors" << endl;
* *for(vector< vector<T::itera tor ite = vec.begin(); ite!=
I can't see anything wrong on the 15th line (the above is the 13th) but
try using
* for (typename vector< vector<T::itera tor ite = ...
--
Erik Wikström
Hi Erik, and many thanks for your input.
Two things:
- How did you figure out that by adding "typename" the error would
go?...by the way the error message is not appearing anymore...
Because it is required by the standard. So it is Microsofts compiler
that is broken in this respect, not gcc.
-...however, now I am getting the following error (it looks like it
came from a deeper part of the compiling process):
$ g++ *-Weffc++ -Wall -Wctor-dtor-privacy *-Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(lib cmain.o):
(.text+0xab): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
This is a linker error. You are more likely to get help in a gcc
newsgroup, but most likely you forgot to include a library.
>
Does anybody know if the compiler g++ 3.4.4 is broken?
Yes it is - in the strictest sense of the word. But not here.
/Peter
On Oct 18, 1:51*pm, JR <mr.riv...@yaho o.comwrote:
On Oct 18, 1:05*pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2008-10-18 21:48, JR wrote:
The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
*g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy *-Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
it displays the following errors:
kk.cpp: In function `void Burp(std::ostre am&,
std::vector<std ::vector<T, std::allocator< _CharT,
std::allocator< std::vector<T, std::allocator< _CharT &)':
kk.cpp:15: error: expected `;' before "ite"
kk.cpp:15: error: `ite' undeclared (first use this function)
kk.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Any help is appreciated, Thanks.
CODE:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T& vec)
{
* *os << "Our vector of vectors" << endl;
* *for(vector< vector<T::itera tor ite = vec.begin(); ite!=
I can't see anything wrong on the 15th line (the above is the 13th) but
try using
* for (typename vector< vector<T::itera tor ite = ...
--
Erik Wikström
Hi Erik, and many thanks for your input.
Two things:
- How did you figure out that by adding "typename" the error would
go?...by the way the error message is not appearing anymore...
-...however, now I am getting the following error (it looks like it
came from a deeper part of the compiling process):
$ g++ *-Weffc++ -Wall -Wctor-dtor-privacy *-Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(lib cmain.o):
(.text+0xab): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
Does anybody know if the compiler g++ 3.4.4 is broken?
Thanks again in advance. JR
Hi,
I resolved this problem by going to the mail archive of the cygwin
mailing list for the Cygwin project, posting: http://cygwin.com/ml/cygwin/2004-03/msg00194.html
Based on the command line for the compiling, I tried the following and
it seemd to have worked:
g++ -mno-cygwin -Weffc++ -Wall -Wctor-dtor-privacy -Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
I also utilized Erik W's advice by addding a typename before the
instantiation of the iterator.
Thanks Erik W!
JR
CODE: kk.cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T& vec)
{
os << "Our vector of vectors" << endl;
for(typename vector< vector<T::itera tor ite = vec.begin();
ite!= vec.end();ite++ )
{
copy((*ite).beg in(), (*ite).end(),
ostream_iterato r<T>(os, " "));
os << endl;
}
os << "/Our vector of vectors" << endl;
}
int main(int argc, char argv[])
{
return 0;
}
On Oct 18, 11:12*pm, peter koch <peter.koch.lar ...@gmail.comwr ote:
On 18 Okt., 22:51, JR <mr.riv...@yaho o.comwrote:
- How did you figure out that by adding "typename" the error
would go?...by the way the error message is not appearing
anymore...
Because it is required by the standard. So it is Microsofts
compiler that is broken in this respect, not gcc.
Or it's just supporting pre-standard code. Earlier
implementations of templates didn't require typename here, and
any good compiler will have an option allowing the code to
compile even without it. (To be fair, depending on the internal
structure of the compiler, this can be a very expensive option
to implement.)
-...however, now I am getting the following error (it looks like it
came from a deeper part of the compiling process):
$ g++ *-Weffc++ -Wall -Wctor-dtor-privacy *-Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(lib cmain.o):
(.text+0xab): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
This is a linker error. You are more likely to get help in a gcc
newsgroup, but most likely you forgot to include a library.
With a name like _WinMain, I'd guess that he's trying to compile
Microsoft specific code on a non-Microsoft platform.
--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
James Kanze wrote:
On Oct 18, 11:12 pm, peter koch <peter.koch.lar ...@gmail.comwr ote:
>On 18 Okt., 22:51, JR <mr.riv...@yaho o.comwrote:
>>- How did you figure out that by adding "typename" the error would go?...by the way the error message is not appearing anymore...
>Because it is required by the standard. So it is Microsofts compiler that is broken in this respect, not gcc.
Or it's just supporting pre-standard code. Earlier
implementations of templates didn't require typename here, and
any good compiler will have an option allowing the code to
compile even without it. (To be fair, depending on the internal
structure of the compiler, this can be a very expensive option
to implement.)
VC, however, simply doesn't have two-phase lookup, so it has to
"guess" if a 'typename' would have been required /after/ the
template is instantiated. (At least that's my theory how it works.)
The lack of two-phase lookup is /really/ annoying and makes VC
almost unsuitable for any more serious work on template-heavy
library code.
(Just as a test, this
template< typename T >
void f() {blarxl}
int main() {
return 0;
}
indeed compiles fine using VC.)
[...]
Schobi This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt |
last post by:
Just out of the blue all of my code has given a 'Could not instantiate the
resource processor.' error on compiling. This apparently means your
installation of VS .Net has lost the plot. So I've installed over it,
removed it and reinstalled and then reinstalled the framework, now it
doesn't always give me the build errors it just says there are on compiling,
and then shows you an empty task list.
Also when I try to add a reference to a NET...
|
by: bmwrob |
last post by:
I’m very new in C++ programming and am trying to make a decoder tool
just for the purpose of learning. I started my project in VC++ 6.0,
but after a change of PC, I continued my programming in VS .NET.
Now I get a lot of compiling error which I don’t understand. Here is
an extract from the code:
int iOct;
CString sASCII;
|
by: Qiao Yun |
last post by:
I used vc++.net (visual studio .net ) to open a project which can work well
in vc++6.0. I succeeded in compiling the project in vc++.net in release
mode .
But when I tried to compile the project in debug mode, the following errors
happened:
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29):
error C2365: 'new' : redefinition; previous definition was a 'member
function'
d:\Program Files\Microsoft Visual Studio...
|
by: Herman Jones |
last post by:
I'm getting the following error when I build a Class Library project:
Embedding manifest...
Project : error PRJ0002 : Error result 1 returned from
'C:\WINDOWS\system32\cmd.exe'.
It happens with every the of C++ project I try to build. Not just Class
Libraries, but a plain Windows Form Application as well.
I've tried creating new projects with nothing but shell built by the Wizard,
but I still get the error.
|
by: teddybyte |
last post by:
my script below is:
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
| |
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2
Ask on python-list@python.org .
- Josiah
|
by: sahilrekhi |
last post by:
Hi i am working on a graphical user interface deisgn programme. when i compile the file i i get the following output with the mentioned errors:
1>------ Rebuild All started: Project: guiq, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'guiq', configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>Custom Message.cpp
1>guiq.cpp
1>Generating Code...
|
by: SQACPP |
last post by:
I have an error when compiling a simple form project...
I just start a new Form project and add a new PictureBox in a form(or
anything that generate the .resx file)
After that when compiling I always get the following error (in VS
2005):
Compiling...
|
by: dami.gupta |
last post by:
I am building a chm file using sandcastle and am following
instructions on
https://blogs.msdn.com/sandcastle/archive/2006/07/29/682398.aspx
I am following all the commands which are proceeding kind of ok, until
I get to
hhc output\test.hhp
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |