4.C++中程序中的命名空间

咱们在前面的程序中,提到过使用using namespace std;引入这个命名空间,那么std就是由编程系统提供的标准命名空间,那什么是命名空间呢?

想像一下,比如一个年级的学生,在记录的时候出现了重名的情况,那么这个时候应该怎么记录呢,是不是需要加一些其它的名称,比如,一三班小李同学,一一班小李同学,那个C++中也会存在类似的情况,比如我们定义一个打印函数,

#include <iostream>
using namespace std;

void prnt()  //打印A
{
	cout << "printA" << endl;
}

int main()
{
	prnt();
	return 0;
}

上面定义了一个prnt()函数,程序执行:

但是如果想再定义一个,那么这个时间,如果再写一个,会出现什么情况?

#include <iostream>
using namespace std;

void prnt()  //打印A
{
	cout << "printA" << endl;
}
void prnt()  //打印A
{
	cout << "printB" << endl;
}

int main()
{
	prnt();
	return 0;
}

这个时候运行程序,会出现什么情况?

下面的错误提示,

提示重复定义。

这个时候应该给一个改名,当然改名字没有任何问题,可以使用,但是如果不改名,应该怎么处理,这个时候就可以使用命名空间,

#include <iostream>
using namespace std;

namespace A {
	void prnt() { //打印A
		cout << "printA" << endl;
	}
}
namespace B {
	void prnt() { //打印A
		cout << "printB" << endl;
	}
}
int main() {
	A::prnt();
	B::prnt();
	return 0;
}

增加了两个命名空间,A和B,在使用的时候,直接使用A::prnt();B::print()即可调用不同的函数,就像喊小李同学一样,如果直接喊,那么不知道叫的哪个,但是如果加上一一班小李同学,那么这个时候就可以明确确定是叫谁,这个规则是一样的。

命名空间可以定义到一个文件中,也可以定义到几个文件中,即不一定是连续的文件中,这个时候只要引入即要将同样的命名空间引入。

命名空间中可以定义常量,变量,函数等,并且可以嵌套,如

#include <iostream>
using namespace std;

namespace A {
	namespace AA{
	void prnt() { //打印A
		cout << "printA" << endl;
	}
	}
}

int main() {
	A::AA::prnt();
	return 0;
}

在A的命名空间中再定义了AA的空间,那么引入的时候,就成了A::AA::prnt()即可。

但是注意命名空间只能定义到全局,不能定义到函数中,比如

#include <iostream>
using namespace std;

void funA()
{
	namespace A {
		namespace AA {
			void prnt() { //打印A
				cout << "printA" << endl;
			}
		}
	}
}
int main() {
	A::AA::prnt();
	return 0;
}

那么这个时候就是错误的,

 这个在使用的时候注意即可。

gezi@ubuntu:~/study/pubilc/camerademo8/LinkSDK$ make : Compiling portfiles/aiot_port/posix_port.c ... : Compiling core/aiot_state_api.c ... : Compiling core/sysdep/core_adapter.c ... : Compiling core/sysdep/core_sysdep.c ... : Compiling core/aiot_mqtt_api.c ... : Compiling core/utils/core_auth.c ... : Compiling core/utils/core_diag.c ... : Compiling core/utils/core_sha256.c ... : Compiling core/utils/core_string.c ... : Compiling core/utils/core_global.c ... : Compiling core/utils/core_log.c ... : Compiling curl/share/doc/wolfssl/example/sctp-server-dtls.c ... : Compiling curl/share/doc/wolfssl/example/client.c ... : Compiling curl/share/doc/wolfssl/example/echoserver.c ... : Compiling curl/share/doc/wolfssl/example/sctp-client.c ... : Compiling curl/share/doc/wolfssl/example/sctp-server.c ... : Compiling curl/share/doc/wolfssl/example/tls_bench.c ... : Compiling curl/share/doc/wolfssl/example/async_client.c ... : Compiling curl/share/doc/wolfssl/example/sctp-client-dtls.c ... : Compiling curl/share/doc/wolfssl/example/client/client.c ... : Compiling curl/share/doc/wolfssl/example/async_server.c ... : Compiling curl/share/doc/wolfssl/example/echoclient.c ... : Compiling curl/share/doc/wolfssl/example/server.c ... : Compiling components/logpost/aiot_logpost_api.c ... : Compiling components/mqtt_upload/upload_crc64.c ... : Compiling components/mqtt_upload/aiot_mqtt_upload_api.c ... : Compiling components/data-model/aiot_dm_api.c ... : Compiling components/curl/share/doc/wolfssl/example/sctp-server-dtls.c ... : Compiling components/curl/share/doc/wolfssl/example/client.c ... : Compiling components/curl/share/doc/wolfssl/example/echoserver.c ... : Compiling components/curl/share/doc/wolfssl/example/sctp-client.c ... : Compiling components/curl/share/doc/wolfssl/example/sctp-server.c ... : Compiling components/curl/share/doc/wolfssl/example/tls_bench.c ... : Compiling components/curl/share/doc/wolfssl/example/async_client.c ... : Compiling components/curl/share/doc/wolfssl/example/sctp-client-dtls.c ... : Compiling components/curl/share/doc/wolfssl/example/client/client.c ... : Compiling components/curl/share/doc/wolfssl/example/async_server.c ... : Compiling components/curl/share/doc/wolfssl/example/echoclient.c ... : Compiling components/curl/share/doc/wolfssl/example/server.c ... : Compiling components/examples/echoclient/echoclient.c ... : Compiling components/examples/sctp/sctp-server-dtls.c ... : Compiling components/examples/sctp/sctp-client.c ... : Compiling components/examples/sctp/sctp-server.c ... : Compiling components/examples/sctp/sctp-client-dtls.c ... : Compiling components/examples/benchmark/tls_bench.c ... : Compiling components/examples/pem/pem.c ... : Compiling components/examples/asn1/asn1.c ... : Compiling components/examples/async/async_tls.c ... : Compiling components/examples/async/async_client.c ... : Compiling components/examples/async/async_server.c ... : Compiling components/examples/echoserver/echoserver.c ... : Compiling components/examples/server/server.c ... : Compiling components/examples/client/client.c ... : Compiling components/ntp/aiot_ntp_api.c ... : Compiling external/mbedtls/library/entropy.c ... : Compiling external/mbedtls/library/sha256.c ... : Compiling external/mbedtls/library/debug.c ... : Compiling external/mbedtls/library/sha512.c ... : Compiling external/mbedtls/library/ssl_ciphersuites.c ... : Compiling external/mbedtls/library/rsa.c ... : Compiling external/mbedtls/library/aes.c ... : Compiling external/mbedtls/library/ssl_cookie.c ... : Compiling external/mbedtls/library/cipher.c ... : Compiling external/mbedtls/library/asn1parse.c ... : Compiling external/mbedtls/library/rsa_internal.c ... : Compiling external/mbedtls/library/pkparse.c ... : Compiling external/mbedtls/library/md.c ... : Compiling external/mbedtls/library/pk.c ... : Compiling external/mbedtls/library/cipher_wrap.c ... : Compiling external/mbedtls/library/bignum.c ... : Compiling external/mbedtls/library/error.c ... : Compiling external/mbedtls/library/sha1.c ... : Compiling external/mbedtls/library/ctr_drbg.c ... : Compiling external/mbedtls/library/pem.c ... : Compiling external/mbedtls/library/x509.c ... : Compiling external/mbedtls/library/md_wrap.c ... : Compiling external/mbedtls/library/base64.c ... : Compiling external/mbedtls/library/x509_crt.c ... : Compiling external/mbedtls/library/ssl_cli.c ... : Compiling external/mbedtls/library/platform.c ... : Compiling external/mbedtls/library/platform_util.c ... : Compiling external/mbedtls/library/ssl_tls.c ... : Compiling external/mbedtls/library/pk_wrap.c ... : Compiling external/mbedtls/library/oid.c ... : Compiling external/ali_ca_cert.c ... + Linking output/lib/libaiot.so ... output/./curl/share/doc/wolfssl/example/client.o: In function `main': client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/echoserver.o: In function `main': echoserver.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/sctp-client.o: In function `main': sctp-client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/sctp-server.o: In function `main': sctp-server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/tls_bench.o:(.bss+0x8): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./curl/share/doc/wolfssl/example/tls_bench.o:(.bss+0x4): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./curl/share/doc/wolfssl/example/tls_bench.o: In function `main': tls_bench.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/async_client.o: In function `main': async_client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/sctp-client-dtls.o: In function `main': sctp-client-dtls.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/client/client.o: In function `client_test': client.c:(.text+0x11ec): multiple definition of `client_test' output/./curl/share/doc/wolfssl/example/client.o:client.c:(.text+0x11ec): first defined here output/./curl/share/doc/wolfssl/example/client/client.o:(.bss+0x1010): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./curl/share/doc/wolfssl/example/client/client.o:(.bss+0x100c): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./curl/share/doc/wolfssl/example/client/client.o:(.data.rel.local+0x308): multiple definition of `starttlsCmd' output/./curl/share/doc/wolfssl/example/client.o:(.data.rel.local+0x308): first defined here output/./curl/share/doc/wolfssl/example/client/client.o: In function `main': client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/async_server.o: In function `main': async_server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/echoclient.o: In function `main': echoclient.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./curl/share/doc/wolfssl/example/server.o:(.bss+0x10): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./curl/share/doc/wolfssl/example/server.o:(.bss+0xc): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./curl/share/doc/wolfssl/example/server.o: In function `main': server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/sctp-server-dtls.o: In function `main': sctp-server-dtls.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/client.o: In function `client_test': client.c:(.text+0x11ec): multiple definition of `client_test' output/./curl/share/doc/wolfssl/example/client.o:client.c:(.text+0x11ec): first defined here output/./components/curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/curl/share/doc/wolfssl/example/client.o:(.data.rel.local+0x308): multiple definition of `starttlsCmd' output/./curl/share/doc/wolfssl/example/client.o:(.data.rel.local+0x308): first defined here output/./components/curl/share/doc/wolfssl/example/client.o: In function `main': client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/echoserver.o: In function `echoserver_test': echoserver.c:(.text+0x78): multiple definition of `echoserver_test' output/./curl/share/doc/wolfssl/example/echoserver.o:echoserver.c:(.text+0x78): first defined here output/./components/curl/share/doc/wolfssl/example/echoserver.o: In function `main': echoserver.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/sctp-client.o: In function `main': sctp-client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/sctp-server.o: In function `main': sctp-server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/tls_bench.o: In function `bench_tls': tls_bench.c:(.text+0x2394): multiple definition of `bench_tls' output/./curl/share/doc/wolfssl/example/tls_bench.o:tls_bench.c:(.text+0x2394): first defined here output/./components/curl/share/doc/wolfssl/example/tls_bench.o:(.bss+0x8): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/curl/share/doc/wolfssl/example/tls_bench.o:(.bss+0x4): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/curl/share/doc/wolfssl/example/tls_bench.o: In function `main': tls_bench.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/async_client.o: In function `client_async_test': async_client.c:(.text+0x4a0): multiple definition of `client_async_test' output/./curl/share/doc/wolfssl/example/async_client.o:async_client.c:(.text+0x4a0): first defined here output/./components/curl/share/doc/wolfssl/example/async_client.o: In function `main': async_client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/sctp-client-dtls.o: In function `main': sctp-client-dtls.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/client/client.o: In function `client_test': client.c:(.text+0x11ec): multiple definition of `client_test' output/./curl/share/doc/wolfssl/example/client.o:client.c:(.text+0x11ec): first defined here output/./components/curl/share/doc/wolfssl/example/client/client.o:(.bss+0x1010): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/curl/share/doc/wolfssl/example/client/client.o:(.bss+0x100c): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/curl/share/doc/wolfssl/example/client/client.o:(.data.rel.local+0x308): multiple definition of `starttlsCmd' output/./curl/share/doc/wolfssl/example/client.o:(.data.rel.local+0x308): first defined here output/./components/curl/share/doc/wolfssl/example/client/client.o: In function `main': client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/async_server.o: In function `server_async_test': async_server.c:(.text+0x64): multiple definition of `server_async_test' output/./curl/share/doc/wolfssl/example/async_server.o:async_server.c:(.text+0x64): first defined here output/./components/curl/share/doc/wolfssl/example/async_server.o: In function `main': async_server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/echoclient.o: In function `echoclient_test': echoclient.c:(.text+0x78): multiple definition of `echoclient_test' output/./curl/share/doc/wolfssl/example/echoclient.o:echoclient.c:(.text+0x78): first defined here output/./components/curl/share/doc/wolfssl/example/echoclient.o: In function `main': echoclient.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/curl/share/doc/wolfssl/example/server.o:(.bss+0x18): multiple definition of `runWithErrors' output/./curl/share/doc/wolfssl/example/server.o:(.bss+0x18): first defined here output/./components/curl/share/doc/wolfssl/example/server.o: In function `ServerEchoData': server.c:(.text+0xbbc): multiple definition of `ServerEchoData' output/./curl/share/doc/wolfssl/example/server.o:server.c:(.text+0xbbc): first defined here output/./components/curl/share/doc/wolfssl/example/server.o: In function `server_test': server.c:(.text+0xf30): multiple definition of `server_test' output/./curl/share/doc/wolfssl/example/server.o:server.c:(.text+0xf30): first defined here output/./components/curl/share/doc/wolfssl/example/server.o:(.bss+0x10): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/curl/share/doc/wolfssl/example/server.o:(.bss+0xc): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/curl/share/doc/wolfssl/example/server.o:(.bss+0x14): multiple definition of `catastrophic' output/./curl/share/doc/wolfssl/example/server.o:(.bss+0x14): first defined here output/./components/curl/share/doc/wolfssl/example/server.o: In function `main': server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/echoclient/echoclient.o: In function `echoclient_test': echoclient.c:(.text+0x78): multiple definition of `echoclient_test' output/./curl/share/doc/wolfssl/example/echoclient.o:echoclient.c:(.text+0x78): first defined here output/./components/examples/echoclient/echoclient.o: In function `main': echoclient.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/sctp/sctp-server-dtls.o: In function `main': sctp-server-dtls.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/sctp/sctp-client.o: In function `main': sctp-client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/sctp/sctp-server.o: In function `main': sctp-server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/sctp/sctp-client-dtls.o: In function `main': sctp-client-dtls.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/benchmark/tls_bench.o: In function `bench_tls': tls_bench.c:(.text+0x2394): multiple definition of `bench_tls' output/./curl/share/doc/wolfssl/example/tls_bench.o:tls_bench.c:(.text+0x2394): first defined here output/./components/examples/benchmark/tls_bench.o:(.bss+0x8): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/examples/benchmark/tls_bench.o:(.bss+0x4): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/examples/benchmark/tls_bench.o: In function `main': tls_bench.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/pem/pem.o: In function `main': pem.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/asn1/asn1.o:(.data.rel.local+0x0): multiple definition of `usage' output/./components/examples/pem/pem.o:(.data.rel.local+0x0): first defined here /home/gezi/study/work/allwinner/out/t113_i/ebyte_t113i/buildroot/buildroot/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabi/7.3.1/../../../../arm-linux-gnueabi/bin/ld: Warning: size of symbol `usage' changed from 76 in output/./components/examples/pem/pem.o to 72 in output/./components/examples/asn1/asn1.o output/./components/examples/asn1/asn1.o: In function `main': asn1.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/async/async_client.o: In function `client_async_test': async_client.c:(.text+0x4a0): multiple definition of `client_async_test' output/./curl/share/doc/wolfssl/example/async_client.o:async_client.c:(.text+0x4a0): first defined here output/./components/examples/async/async_client.o: In function `main': async_client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/async/async_server.o: In function `server_async_test': async_server.c:(.text+0x64): multiple definition of `server_async_test' output/./curl/share/doc/wolfssl/example/async_server.o:async_server.c:(.text+0x64): first defined here output/./components/examples/async/async_server.o: In function `main': async_server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/echoserver/echoserver.o: In function `echoserver_test': echoserver.c:(.text+0x78): multiple definition of `echoserver_test' output/./curl/share/doc/wolfssl/example/echoserver.o:echoserver.c:(.text+0x78): first defined here output/./components/examples/echoserver/echoserver.o: In function `main': echoserver.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/server/server.o:(.bss+0x18): multiple definition of `runWithErrors' output/./curl/share/doc/wolfssl/example/server.o:(.bss+0x18): first defined here output/./components/examples/server/server.o: In function `ServerEchoData': server.c:(.text+0xbbc): multiple definition of `ServerEchoData' output/./curl/share/doc/wolfssl/example/server.o:server.c:(.text+0xbbc): first defined here output/./components/examples/server/server.o: In function `server_test': server.c:(.text+0xf30): multiple definition of `server_test' output/./curl/share/doc/wolfssl/example/server.o:server.c:(.text+0xf30): first defined here output/./components/examples/server/server.o:(.bss+0x10): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/examples/server/server.o:(.bss+0xc): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/examples/server/server.o:(.bss+0x14): multiple definition of `catastrophic' output/./curl/share/doc/wolfssl/example/server.o:(.bss+0x14): first defined here output/./components/examples/server/server.o: In function `main': server.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here output/./components/examples/client/client.o: In function `client_test': client.c:(.text+0x11ec): multiple definition of `client_test' output/./curl/share/doc/wolfssl/example/client.o:client.c:(.text+0x11ec): first defined here output/./components/examples/client/client.o:(.bss+0x1010): multiple definition of `myoptind' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x1010): first defined here output/./components/examples/client/client.o:(.bss+0x100c): multiple definition of `myoptarg' output/./curl/share/doc/wolfssl/example/client.o:(.bss+0x100c): first defined here output/./components/examples/client/client.o:(.data.rel.local+0x308): multiple definition of `starttlsCmd' output/./curl/share/doc/wolfssl/example/client.o:(.data.rel.local+0x308): first defined here output/./components/examples/client/client.o: In function `main': client.c:(.text.startup+0x0): multiple definition of `main' output/./curl/share/doc/wolfssl/example/sctp-server-dtls.o:sctp-server-dtls.c:(.text.startup+0x0): first defined here collect2: error: ld returned 1 exit status Makefile:65: recipe for target 'libaiot' failed make: *** [libaiot] Error 1
最新发布
10-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值