Trouble compiling in Dev C++
#include <iostream.h>
void main ()
{
cout << 10 % 8 << endl;
}
--Having trouble compiling the program above. I''m new to Dev C++ and any help would be appreciated. After I compile the program a tab for iostream.h pops up and the errors are as follows...
31 C:\Dev-Cpp\include\c++\backward\iostream.h
In file included from C:/Dev-Cpp/include/c++/backward/iostream.h
1 C:\Documents and Settings\Nelson Marques\Desktop\test.cpp
from C:/Documents and Settings/Nelson Marques/Desktop/test.cpp
2 C:\Dev-Cpp\include\c++\backward\backward_warning.h:32
#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 header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
4 C:\Documents and Settings\Nelson Marques\Desktop\test.cpp
`main'' must return
--NM
Use of the old-style .h headers is deprecated. use #include < iostream > instead.
Also, declare main as:
int main()
or
int main(int argc, char *argv[])
rather than void.
Josh
vertexnormal AT linuxmail DOT org
Check out Golem at:
My cheapass website
[edited by - VertexNormal on September 3, 2003 7:48:02 PM]
Also, declare main as:
int main()
or
int main(int argc, char *argv[])
rather than void.
Josh
vertexnormal AT linuxmail DOT org
Check out Golem at:
My cheapass website
[edited by - VertexNormal on September 3, 2003 7:48:02 PM]
Also remember that the new style headers use namespaces, so you either have to put "using namespace std;" to use cout, or you can use the scope resolution operator as in "std::cout << 10 % 8 << endl;"
actually, now i''m getting a few different errors... here they are...
C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
[Warning] In function:
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
`cout''
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
(Each
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
`endl''
C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
[Warning] In function:
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
`cout''
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
(Each
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
`endl''
#include <iostream>
int main ()
{
std::cout << 10 % 8 << endl;
}
Ok, the above program still getting these errors..
C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
[Warning] In function:
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
`endl''
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
(Each
int main ()
{
std::cout << 10 % 8 << endl;
}
Ok, the above program still getting these errors..
C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
[Warning] In function:
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
`endl''
5 C:\Documents and Settings\Nelson Marques\Desktop\Untitled1.cpp
(Each
I'm sorry, i forgot about endl. If you don't use namespaces, you have to use scope resolution for all objects you use from other libraries, and that includes endl. Try this:
#include <iostream>
int main ()
{
std::cout << 10 % 8 << std::endl;
}
[edited by - Vikato on September 3, 2003 8:05:45 PM]
#include <iostream>
int main ()
{
std::cout << 10 % 8 << std::endl;
}
[edited by - Vikato on September 3, 2003 8:05:45 PM]
using namespace std seems a lot more effective IMHO.
Scott Simontis
e-mail:ageofscott@comcast.net
AIM:ssimontis
Scott Simontis
e-mail:ageofscott@comcast.net
AIM:ssimontis
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement