Re: error while cout command compiling

E

ehab

Here they are my trials : please judge I can not find where is error

Trial #1 :
---------
#include <iostream>
/*using namespace std;
int main() {*/
int main(int argc, char **argv) {
/*std::cout<<"hello world"<<std::end1;
cout<<"hello world"<<end1;*/
cout << argv[1] << end1;
}


stupid.cpp: In function `int main(int, char**)':
stupid.cpp:7: `cout' undeclared (first use this function)
stupid.cpp:7: (Each undeclared identifier is reported only once for each
function it appears in.)
stupid.cpp:7: `end1' undeclared (first use this function)


Trial #2 :
---------
#include <iostream>
using namespace std;
int main() {
//std::cout<<"hello world"<<std::end1;
cout << "hello world" << end1;
}


stupid2.cpp: In function `int main()':
stupid2.cpp:5: `end1' undeclared (first use this function)
stupid2.cpp:5: (Each undeclared identifier is reported only once for each
function it appears in.)

Trial #3 :
---------
#include <iostream>
int main() {
std::cout << "hello world" <<std::end1;
}


stupid3.cpp: In function `int main()':
stupid3.cpp:3: `end1' undeclared in namespace `std'
 
V

Victor Bazarov

ehab said:
Here they are my trials : please judge I can not find where is error

Trial #1 :
---------
#include <iostream>
/*using namespace std;
int main() {*/
int main(int argc, char **argv) {
/*std::cout<<"hello world"<<std::end1;
cout<<"hello world"<<end1;*/
cout << argv[1] << end1;
^^^^
If I capitalise this, I will get END1. You need a lower-case
equivalent of ENDL. Do you see the difference?
}


stupid.cpp: In function `int main(int, char**)':
stupid.cpp:7: `cout' undeclared (first use this function)
stupid.cpp:7: (Each undeclared identifier is reported only once for each
function it appears in.)
stupid.cpp:7: `end1' undeclared (first use this function)


Trial #2 :
---------
#include <iostream>
using namespace std;
int main() {
//std::cout<<"hello world"<<std::end1;
cout << "hello world" << end1;
}


stupid2.cpp: In function `int main()':
stupid2.cpp:5: `end1' undeclared (first use this function)
stupid2.cpp:5: (Each undeclared identifier is reported only once for each
function it appears in.)

Trial #3 :
---------
#include <iostream>
int main() {
std::cout << "hello world" <<std::end1;
}


stupid3.cpp: In function `int main()':
stupid3.cpp:3: `end1' undeclared in namespace `std'

Yes, there is not end-ONE in 'std'. There is end-ELL and you should
use _it_ instead. Copy and paste "endl" (without the quotes) into
your program.

Victor
 
E

ehab

To whome adivces me to relace end1 by endl
I go the down erre .


#include <iostream>
int main() {
std::cout << "hello world" <<std::endl;
}


# g++ stupid3.cpp
# ./a*
ld.so.1: ./a.out: fatal: libstdc++.so.5: open failed: No such file or directory
Killed
#
 
R

Rolf Magnus

Again, your problem isn't about C, so please don't ignore the
followup-to again.
Here they are my trials : please judge I can not find where is error

Trial #1 :
---------
#include <iostream>
/*using namespace std;
int main() {*/
int main(int argc, char **argv) {
/*std::cout<<"hello world"<<std::end1;
cout<<"hello world"<<end1;*/
cout << argv[1] << end1;
}


stupid.cpp: In function `int main(int, char**)':
stupid.cpp:7: `cout' undeclared (first use this function)

cout is in namespace std. You commented out everything regarding that
namespace.
stupid.cpp:7: (Each undeclared identifier is reported only once for
each
function it appears in.)
stupid.cpp:7: `end1' undeclared (first use this function)

It's not end1, but endl.
Trial #2 :
---------
#include <iostream>
using namespace std;
int main() {
//std::cout<<"hello world"<<std::end1;
cout << "hello world" << end1;
}


stupid2.cpp: In function `int main()':
stupid2.cpp:5: `end1' undeclared (first use this function)
stupid2.cpp:5: (Each undeclared identifier is reported only once for
each function it appears in.)

Again, not end1, but endl.
Trial #3 :
---------
#include <iostream>
int main() {
std::cout << "hello world" <<std::end1;
}


stupid3.cpp: In function `int main()':
stupid3.cpp:3: `end1' undeclared in namespace `std'

Well...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top