Hi,
While compiling the following code I get a bundle of warnings. Can anyone
tell me why? Should I be using some option while compiling (right now I just
have g++ -o test.o test.cpp)? Or is it because I am using the wrong header?
If so which is the right header? Hope to hear from someone. Thanks!
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <vector.h>
int main(int argc,char* argv[])
{
vector<int> test;
printf("test.size()=%d\n",test.size());
}
Warnings:
bash-2.05b$ g++ -o test.o test.cpp
In file included from
/usr/usc/gnu/gcc/3.3.2/include/c++/3.3.2/backward/vector.h:59,
from test.cpp:4:
/usr/usc/gnu/gcc/3.3.2/include/c++/3.3.2/backward/backward_warning.h:32:2:
warning: #warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the <X> header
for the <X.h> header for C++ includes, or <sstream> instead of the
deprecated header <strstream.h>. To disable this warning
use -Wno-deprecated.
bash-2.05b$ 7 1487
Rookie wrote: While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I just have g++ -o test.o test.cpp)? Or is it because I am using the wrong header? If so which is the right header? Hope to hear from someone. Thanks!
Code: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector.h>
There is no standard header <vector.h>. You should use <vector>. int main(int argc,char* argv[]) { vector<int> test;
Change this to
std::vector<int> test;
as soon as you switch to including <vector> printf("test.size()=%d\n",test.size()); } [...]
Victor
Rookie wrote: While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I just have g++ -o test.o test.cpp)? Or is it because I am using the wrong header? If so which is the right header? Hope to hear from someone. Thanks!
Code: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector.h>
These includes are now
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
.... just as the warning indicates.
--
__ Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ Can I be your friend / 'Till the end
-- India Arie
drop the .h
#include <vector>
using std::vector;
int main()
{
vector<int> test;
}
Mike
"Rookie" <do***********@rediffmail.com> wrote in message
news:ck**********@gist.usc.edu... Hi,
While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I
just have g++ -o test.o test.cpp)? Or is it because I am using the wrong
header? If so which is the right header? Hope to hear from someone. Thanks!
Code: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector.h>
int main(int argc,char* argv[]) { vector<int> test;
printf("test.size()=%d\n",test.size()); }
Warnings: bash-2.05b$ g++ -o test.o test.cpp In file included from /usr/usc/gnu/gcc/3.3.2/include/c++/3.3.2/backward/vector.h:59, from test.cpp:4: /usr/usc/gnu/gcc/3.3.2/include/c++/3.3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. bash-2.05b$
On Wed, 13 Oct 2004 15:15:25 -0700, Rookie wrote: Hi,
While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I just have g++ -o test.o test.cpp)? Or is it because I am using the wrong header? If so which is the right header? Hope to hear from someone. Thanks!
What everyone else said, and it looks like you might need a good, recent
book on the language. Bruce Eckel has a book on beginners' C++ free to
download here: http://www.mindview.net/Books/TICPP/...ngInCPP2e.html
I set followups to comp.lang.c++, since this affects neither Unix nor
Solaris.
Rookie wrote: Hi,
While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I just have g++ -o test.o test.cpp)? Or is it because I am using the wrong header? If so which is the right header? Hope to hear from someone. Thanks!
Code: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector.h>
int main(int argc,char* argv[]) { vector<int> test;
printf("test.size()=%d\n",test.size()); }
Warnings: bash-2.05b$ g++ -o test.o test.cpp In file included from /usr/usc/gnu/gcc/3.3.2/include/c++/3.3.2/backward/vector.h:59, from test.cpp:4: /usr/usc/gnu/gcc/3.3.2/include/c++/3.3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. bash-2.05b$
This warning is actually rather good. It tells you exactly what is your
problem, how to "fix" it, and even a refrence to the relevant standard
paragraph.
On Wed, 13 Oct 2004 15:15:25 -0700, Rookie <do***********@rediffmail.com> wrote: While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I just have g++ -o test.o test.cpp)? Or is it because I am using the wrong header? If so which is the right header? Hope to hear from someone. Thanks!
I think that there are two fundamental problems
a) you can't read
b) you are bothering thousands of people with your reading inability.
Paul
--
Paul Floyd http://paulf.free.fr (for what it's worth)
Surgery: ennobled Gerald.
On Wed, 13 Oct 2004 15:15:25 -0700, Rookie wrote: Hi,
While compiling the following code I get a bundle of warnings. Can anyone tell me why? Should I be using some option while compiling (right now I just have g++ -o test.o test.cpp)? Or is it because I am using the wrong header? If so which is the right header? Hope to hear from someone. Thanks!
Code: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector.h>
int main(int argc,char* argv[]) { vector<int> test;
printf("test.size()=%d\n",test.size()); }
Apart from the other problems, the printf above should be...
printf("test.size()=%zu\n", test.size());
....and you might even need a cast, if std::vector<int>::size_type can be
anything else.
--
James Antill -- ja***@and.org
Need an efficient and powerful string library for C? http://www.and.org/vstr/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Aramini |
last post by:
I need to represent 1D and 2D arrays of numeric or bool types in a C++
program. The sizes of the arrays in my intended application are
dynamic in the sense that they are not known at compile time,...
|
by: Pratyush |
last post by:
Hi,
Suppose there is a vector of objects of class A, i.e., std::vector<A>
vec_A(N); The class A satisifies all the STL vector requirements.
Now I wish to add some attributes for each of the...
|
by: Computer Whizz |
last post by:
I was reading through Accelerated C++ at work when I read through the first
mention of Vectors, giving us certain functions etc.
Is there any benefit of Arrays over Vectors? Since all Vectors...
|
by: chris |
last post by:
Hello,
I've recently been trying to understand the various structures supplied
by c++, and the one I find most confusing is deque.
One quick question about this. It seems most implementations...
|
by: Amit |
last post by:
Hello.
I am having some problem organizing a set of vectors. The vectors itself,
could contain a pointer( say integer pointer) or could contain another
object MyClass.
1>So, first of all, is...
|
by: Dr. J.K. Becker |
last post by:
Hi all,
I have vectors that holds pointers to other vectors, like so:
vector<whatever> x;
vector<whatever*> z;
z=&x;
Now I add something to x
|
by: madhu |
last post by:
http://msdn2.microsoft.com/en-us/library/fs5a18ce(VS.80).aspx
vector <intv1;
v1.push_back( 10 ); //adds 10 to the tail
v1.push_back( 20 ); //adds 20 to the tail
cout << "The size of v1 is " <<...
|
by: wuzertheloser |
last post by:
Use the program skeleton below (starting with #include <stdio.h>)
as the starting point for quiz4. Add the necessary code to the
functions prob1() and prob2(), and add the other 2 functions, as...
|
by: Rob |
last post by:
How would I do this?
I want to be able to handle vectors of many different types of data
and vectors that can contain any number of other vectors of data.
Currently, I have a templated...
|
by: joeme |
last post by:
How would one using STL do the following tasks:
1) merge 2 sorted vectors with dupes, result shall be sorted
2) merge 2 sorted vectors without dupes, result shall be sorted
3) merge 2...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |