"multiple definition of `main'" 编译 mbed OS 程序时出错

"multiple definition of `main'" error when compiling a mbed OS program

我编译了一个测试,但出现了很多错误。我不知道那是什么。谁能解释一下。

D:\Projects\mbed-os-example-blinky-master>mbed test -m ublox_c030_u201 -t gcc_arm --compile

Build failures:
  * UBLOX_C030_U201::GCC_ARM::MBED-OS-FEATURES-FEATURE_LWIP-TESTS-MBEDMICRO-NET-CONNECTIVITY
        Building project connectivity (UBLOX_C030_U201, GCC_ARM)
        Scan: gcc_arm
        Scan: connectivity
        Scan: FEATURE_LWIP
        Link: connectivity
        D:/Projects/mbed-os-example-blinky-master/BUILD/tests/ublox_c030_u201/gcc_arm/main.o: In function `main':
        main.cpp:(.text.startup.main+0x0): multiple definition of `main'
        D:/Projects/mbed-os-example-blinky-master/BUILD/tests/ublox_c030_u201/gcc_arm/./mbed-os/features/FEATURE_LWIP/TESTS/mbedmicro-net/connectivity/./main.o:main.cpp:(.text.startup.main+0x0): first defined here
        collect2.exe: error: ld returned 1 exit status


[mbed] ERROR: "c:\python27\python.exe" returned error code 1.
[mbed] ERROR: Command "c:\python27\python.exe -u D:\Projects\mbed-os-example-blinky-master\mbed-os\tools\test.py -t gcc_arm -m ublox_c030_u201 --source D:\Projects\mbed-os-example-blinky-master --build D:\Projects\mbed-os-example-blinky-master\BUILD\tests\ublox_c030_u201\gcc_arm --test-spec D:\Projects\mbed-os-example-blinky-master\BUILD\tests\ublox_c030_u201\gcc_arm\test_spec.json" in "D:\Projects\mbed-os-example-blinky-master"

您正在为此目标编译测试,同时您也有自己的程序。这不会起作用,因为测试和您的程序都有 main 函数。

改为:

mbed compile -m ublox_c030_u201 -t gcc_arm