How can I run Cunit tests in CLion.
I working on a project and would like to use Cunit to run my tests. However, I have been having a problem where I get a message that looks like so :
Undefined symbols for architecture x86_64:
"_CU_add_suite", referenced from:
_main in test_assembler.c.o
"_CU_add_test", referenced from:
_main in test_assembler.c.o
"_CU_assertImplementation", referenced from:
_check_lines_equal in test_assembler.c.o
_test_translate_num in test_assembler.c.o
_test_table_1 in test_assembler.c.o
_test_table_2 in test_assembler.c.o
"_CU_basic_run_tests", referenced from:
_main in test_assembler.c.o
"_CU_basic_set_mode", referenced from:
_main in test_assembler.c.o
"_CU_cleanup_registry", referenced from:
_main in test_assembler.c.o
"_CU_get_error", referenced from:
_main in test_assembler.c.o
"_CU_initialize_registry", referenced from:
_main in test_assembler.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1
I tried using the commands below in Cmakelist.txt in hopes that the cunit library would be included and hence linked to the executable, but to no avail.
include_directories(/usr/local/Cellar/Cunit/2.1-3/include)
link_directories(/usr/local/lib)
How can get this to work?
Thanks.
Please sign in to leave a comment.
Hi!
Unfortunately, it hasn't been implemented in CLion yet: https://youtrack.jetbrains.com/issue/CPP-2470. Feel free to comment or upvote.