|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++.stl - Compiler complains of copy on implied return for an STL vector
Guys;
I'm attempting to work through a series of STL examples from a back issue of the
C++ report and my step 1 program looks like the following:
#include <vector>
vector<int> less_than_10(const vector<int>& vec)
{
vector<int> nvec;
for (int i = 0; i < vec.size(); ++i)
{
if (vec[i] < 10 )
{
nvec.push_back( vec[i] );
}
}
return nvec;
}
Anyway I compile and get this error:
sc trythis.c -A -cpp -Ae -Ar -r -J -mnw -C -WA -S -5 -a4 -c -l -gf
-IC:\dm\include -I c:\dm\stl -otrythis.obj
Error: C:\DM\PROGRAMS\trythis.c(23): implied return of vector<int
,__default_alloc_template<0,0> >::_M_allocate_and_copy at closing '}' does not
return value
Lines Processed: 5046 Errors: 1 Warnings: 0
Build failed
I have to mention that this is my 1st programming attempt with Digital Mars and
yes it is an older version 7.5.3. I am including the STL library in my project
and the compiler is finding vector. If anyone has an idea of what's going on I'd
appreciate some help.
Rick
hessrt earthlink.net
Jan 06 2006
hessrt earthlink.net wrote: Jan 07 2006
Your environment and/or SC.INI is including the old HP headers, and not STLport, which is all that DMC++ is supported with. <hessrt earthlink.net> wrote in message news:dpmg3l$1jsv$1 digitaldaemon.com... Jan 07 2006
<hessrt earthlink.net> wrote in message news:dpmg3l$1jsv$1 digitaldaemon.com...Anyway I compile and get this error: sc trythis.c -A -cpp -Ae -Ar -r -J -mnw -C -WA -S -5 -a4 -c -l -gf -IC:\dm\include -I c:\dm\stl -otrythis.obj Jan 08 2006
Thnks guys for the assist. I used the "-I\dm\stlport\stlport" and it worked great. In article <dprqel$1h80$1 digitaldaemon.com>, Walter Bright says...<hessrt earthlink.net> wrote in message news:dpmg3l$1jsv$1 digitaldaemon.com...Anyway I compile and get this error: sc trythis.c -A -cpp -Ae -Ar -r -J -mnw -C -WA -S -5 -a4 -c -l -gf -IC:\dm\include -I c:\dm\stl -otrythis.obj Jan 08 2006
Thanks Guys: The include of \dm\stlport\stlport worked great. In article <dprqel$1h80$1 digitaldaemon.com>, Walter Bright says...<hessrt earthlink.net> wrote in message news:dpmg3l$1jsv$1 digitaldaemon.com...Anyway I compile and get this error: sc trythis.c -A -cpp -Ae -Ar -r -J -mnw -C -WA -S -5 -a4 -c -l -gf -IC:\dm\include -I c:\dm\stl -otrythis.obj Jan 08 2006
|