如果我运行代码:: blocks default console c ++" hello world" app(见下文),我只在打开的控制台中看到这个:
$ docker exec -it learnintouch_learnintouch-startup.1.ili3m1kre9q2eaiyzlucr2uot bash
root@ce21d5b78886:/usr/bin/learnintouch/www/folkuniversitet# cd /usr/bin/mysql/install; bin/mysql --protocol=tcp -h mysql -P 3306 -u root -pEnter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
root@ce21d5b78886:/usr/bin/mysql/install#
root@ce21d5b78886:/usr/bin/mysql/install#
root@ce21d5b78886:/usr/bin/mysql/install# ping mysql
PING mysql (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=0.110 ms
64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=0.093 ms
64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=0.091 ms
^C
--- mysql ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.040/0.083/0.110/0.027 ms
root@ce21d5b78886:/usr/bin/mysql/install# bin/mysql --protocol=tcp -h mysql -P 3306 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
root@ce21d5b78886:/usr/bin/mysql/install# bin/mysql --protocol=tcp -h mysql -P 3306 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
root@ce21d5b78886:/usr/bin/mysql/install# ping mysql
PING mysql (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=0.091 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=0.105 ms
64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=0.082 ms
^C
--- mysql ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.082/0.092/0.105/0.014 ms
root@ce21d5b78886:/usr/bin/mysql/install# bin/mysql --protocol=tcp -h mysql -P 3306 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
root@ce21d5b78886:/usr/bin/mysql/install# bin/mysql --protocol=tcp -h mysql -P 3306 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
root@ce21d5b78886:/usr/bin/mysql/install# telnet mysql 3306
Trying 10.0.0.4...
Connected to mysql.
Escape character is '^]'.
N
5.6.30-logZo?*R@)M��(~cWg"q5R}?amysql_native_password
^CConnection closed by foreign host.
root@ce21d5b78886:/usr/bin/mysql/install# bin/mysql --protocol=tcp -h mysql -P 3306 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.30-log Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quit;
Bye
root@ce21d5b78886:/usr/bin/mysql/install#
我没有看到"你好世界"。可能有什么不对?
如果我使用cygwin运行./helloworld.exe,我会看到" hello world"。但我不会用cmd或powershell看到它。
该应用:
Process returned 0 (0x0) execution time : 0.011 s
Press any key to continue.
答案 0 :(得分:0)
您可能需要在此处查看相关讨论:
http://www.tomsguide.com/forum/244674-49-basic-program
根据我上面提到的论坛,这可能是程序执行得太快的问题,但这似乎是一个奇怪的原因。您可以尝试他们推荐的内容(暂停等),但您可能也遇到编译器问题或属性设置问题。
对于cmd,请查看:
https://www.thecrazyprogrammer.com/2015/09/how-to-run-c-and-cpp-program-in-cmd.html
对于命令行/ Windows提示符,请检查:
答案 1 :(得分:0)
感谢@George。
解决方法是删除-mwindows编译器标志。
但为了使其工作,我需要在再次构建之前删除.exe。