-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unity Fixtures Compiling Bug (IDFGH-6322) #7984
Comments
Hi @Magdahime, thank you for reporting the issue. It seems that unity_fixture.h header doesn't have C++ guards, which means that UnityMain gets declared with C++ linkage when included from main.cc; at the same time, when UnityMain is compiled, it is compiled with C linkage. Can you please try changing your main.cc like this? extern "C"
{
#include "unity_fixture.h"
}
#include "unity_fixture_extras.h" |
Hi @igrr ! Thank you for your quick response :) I changed it and now it gives me this:
|
Oh, that's unexpected. Is this the only change you did? Could you revert back to the state without |
Hello once again :) Sorry I got sick a little bit. I am back. I checked and for 100% I have fixtures enabled. When I am trying without extern "C" I get this error:
This is the only change I am making. |
Okay I am taking it back - I don't know what happened, but when I tried with extern "C" once again + I deleted whole build/ directory it works! 👍 |
Thanks for confirming! The fix has been merged upstream to Unity repository (ThrowTheSwitch/Unity#586), we will update Unity submodule in IDF soon. |
Unity submodule used in IDF now includes this fix, so I think we can consider this one closed. |
Environment
git describe --tags
to find it):v4.4-dev-1594-g1d7068e4be
xtensa-esp32-elf-gcc --version
to find it):xtensa-esp32-elf-gcc.exe (crosstool-NG esp-2020r3) 8.4.0
Problem Description
I have problem with compiling my unit tests with idf.py. I am trying to use fixtures in my project and I am doing everything as described in https://github.com/ThrowTheSwitch/Unity/tree/master/examples/example_2.
I set up my project as described in https://github.com/espressif/esp-idf/blob/master/examples/system/unit_test/README.md
So my project structure looks like this
I keep getting this error while trying to compile it with
idf.py -p COM3 flash monitor
:FAILED: Tamagotchi_unit_tests.elf
cmd.exe /C "cd . && C:\Users\magda.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address @CMakeFiles\Tamagotchi_unit_tests.elf.rsp -o Tamagotchi_unit_tests.elf && cd ."
c:/users/magda/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.cc.obj):(.literal.app_main+0x10): undefined reference to
UnityMain(int, char const**, void (*)())' c:/users/magda/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.cc.obj): in function
app_main':c:\users\magda\documents\esp\tamagotchi\test\build/../main/main.cc:21: undefined reference to `UnityMain(int, char const**, void (*)())'
Expected Behavior
It should compile.
Actual Behavior
It's not compiling.
Steps to reproduce
Code to reproduce this issue
This is the main.cc of my main component in test project.
Debug Logs
Other items if possible
sdkconfig.txt
The text was updated successfully, but these errors were encountered: