Linux终端中使用makefile编译C++多文件,出现了(.text+0x0): multiple definition of 问题

博客内容涉及C++编程中遇到的问题,主要关于main.cpp和judge.cpp/judge.h的头文件引用。作者在创建makefile时,发现直接使用g++命令可以正常运行,但通过makefile执行时出现错误。问题根源在于main.cpp中错误地包含了judge.cpp,而非judge.h。修复此问题后,make命令得以成功执行。文章强调了头文件正确引用的重要性。

做实验过程中出现的问题:

首先看编写的main.cpp、judge.cpp和judge.h

 

再编写makefile文件:

 当然makefile文件相当于不使用make命令在终端中输入三行命令:

 这样和直接使用make命令效果是一样的,执行后就会出现开头的问题了.

 但是使用 g++ main.cpp 命令后是可以正确执行的,得到想要的结果.

问题的解决办法也很简单,只需要将main.cpp中包含的头文件#include“judge.cpp”改成#include“judge.h”即可,重新去执行make命令.

同时, g++ main.cpp 就报错了.

 两种方法不能兼得.

如果对您有帮助的话,就点个赞!

gcc main.o ListManage.o -o list ListManage.o: In function `screen': ListManage.c:(.text+0x0): multiple definition of `screen' main.o:main.c:(.text+0x0): first defined here ListManage.o: In function `creatNode': ListManage.c:(.text+0x5b): multiple definition of `creatNode' main.o:main.c:(.text+0x5b): first defined here ListManage.o: In function `listPrint': ListManage.c:(.text+0xd1): multiple definition of `listPrint' main.o:main.c:(.text+0xd8): first defined here ListManage.o: In function `listPushBack': ListManage.c:(.text+0x198): multiple definition of `listPushBack' main.o:main.c:(.text+0x156): first defined here ListManage.o: In function `listDelete': ListManage.c:(.text+0x22f): multiple definition of `listDelete' main.o:main.c:(.text+0x1e4): first defined here ListManage.o: In function `listNameFind': ListManage.c:(.text+0x2f8): multiple definition of `listNameFind' main.o:main.c:(.text+0x2ad): first defined here ListManage.o: In function `listIDFind': ListManage.c:(.text+0x349): multiple definition of `listIDFind' main.o:main.c:(.text+0x2fe): first defined here ListManage.o: In function `listDestory': ListManage.c:(.text+0x38d): multiple definition of `listDestory' main.o:main.c:(.text+0x342): first defined here ListManage.o: In function `userInput': ListManage.c:(.text+0x3e4): multiple definition of `userInput' main.o:main.c:(.text+0x399): first defined here collect2: error: ld returned 1 exit status makefile:10: recipe for target 'list' failed make: *** [list] Error 1
08-16
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
g++ -std=c++11 BadString.o main.o -o BadString -I./include main.o: In function `BadString::BadString(char const*)': BadString.cpp:(.text+0x0): multiple definition of `BadString::BadString(char const*)' BadString.o:BadString.cpp:(.text+0x0): first defined here main.o: In function `BadString::BadString(char const*)': BadString.cpp:(.text+0x0): multiple definition of `BadString::BadString(char const*)' BadString.o:BadString.cpp:(.text+0x0): first defined here main.o: In function `BadString::operator[](unsigned long)': BadString.cpp:(.text+0x30): multiple definition of `BadString::operator[](unsigned long)' BadString.o:BadString.cpp:(.text+0x30): first defined here main.o: In function `BadString::operator[](unsigned long) const': BadString.cpp:(.text+0x7c): multiple definition of `BadString::operator[](unsigned long) const' BadString.o:BadString.cpp:(.text+0x7c): first defined here main.o: In function `BadString::operator char*()': BadString.cpp:(.text+0xc8): multiple definition of `BadString::operator char*()' BadString.o:BadString.cpp:(.text+0xc8): first defined here main.o: In function `BadString::operator char const*()': BadString.cpp:(.text+0xd6): multiple definition of `BadString::operator char const*()' BadString.o:BadString.cpp:(.text+0xd6): first defined here /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status Makefile:11: recipe for target 'BadString' failed make: *** [BadString] Error 1
05-19
/usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x0): multiple definition of `info_compiler'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x0): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x40): multiple definition of `info_platform'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x40): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0x80): multiple definition of `info_arch'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0x80): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.data.rel.local+0xc0): multiple definition of `info_language_dialect_default'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.data.rel.local+0xc0): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: in function `main': CMakeCXXCompilerId.cpp:(.text+0x0): multiple definition of `main'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:CMakeCCompilerId.c:(.text+0x0): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.bss+0x0): multiple definition of `__odr_asan.info_language_dialect_default'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.bss+0x0): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.bss+0x1): multiple definition of `__odr_asan.info_arch'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.bss+0x1): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.bss+0x2): multiple definition of `__odr_asan.info_platform'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.bss+0x2): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp.o:(.bss+0x3): multiple definition of `__odr_asan.info_compiler'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:(.bss+0x4): first defined here /usr/bin/ld: CMakeFiles/doubaox_demo.dir/doubao_process.c.o: in function `main': doubao_process.c:(.text+0x231): multiple definition of `main'; CMakeFiles/doubaox_demo.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.o:CMakeCCompilerId.c:(.text+0x0): first defined here
最新发布
11-19
PS E:\VSCode\cube> mingw32-make gcc -Wall -g -o test cube.o d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x2a0): multiple definition of `_mingw32_init_mainargs' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x2a0): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x2e0): multiple definition of `mainCRTStartup' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x2e0): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x300): multiple definition of `WinMainCRTStartup' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x300): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x320): multiple definition of `atexit' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x320): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x330): multiple definition of `_onexit' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x330): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x340): multiple definition of `__gcc_register_frame' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0x0): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.text+0x430): multiple definition of `__gcc_deregister_frame' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0xf0): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.bss+0x4): multiple definition of `_argc' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.bss+0x4): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.bss+0x0): multiple definition of `_argv' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.bss+0x0): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: Dwarf Error: Could not find abbrev number 84. cube.o:cygming-crtbegin.c:(.eh_frame+0xb8): multiple definition of `__EH_FRAME_BEGIN__' d:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.eh_frame+0x0): first defined here d:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0x92): undefined reference to `_Jv_RegisterClasses' collect2.exe: error: ld returned 1 exit status Makefile:15: recipe for target 'test' failed mingw32-make: *** [test] Error 1 PS E:\VSCode\cube>
06-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值