Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22191

Allow double floating point comparisons with Unity unit testing framework from Throw The Switch

$
0
0

I'm having some trouble somewhere with the linker while trying to compile a test written using the Unity testing framework by Throw The Switch. I have other tests that compile and run perfectly fine so I'm definitely just missing something in enabling the assertion helper for double floating point comparisons.

There is documentation in the header file telling us how to enable double floating point comparisons.

 *     - define UNITY_INCLUDE_DOUBLE to allow double floating point comparisons

However, I end up with this error:

Undefined symbols for architecture x86_64:"_UnityAssertDoublesWithin", referenced from:      _test_example in main-6fae82.old: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)

I wrote up the simplest example possible to duplicate this:

#define UNITY_INCLUDE_DOUBLE#include "unity.h"void test_example(void){    TEST_ASSERT_EQUAL_DOUBLE(1.234, 1.234);}int main(void) {    UNITY_BEGIN();    RUN_TEST(test_example);    return UNITY_END();}

The contents of the CWD of the example and the exact command used to call clang (showing the same error again):

$ lsmain.c          unity.c         unity.h         unity_internals.h$ clang unity.c main.cUndefined symbols for architecture x86_64:"_UnityAssertDoublesWithin", referenced from:      _test_example in main-ee77c2.old: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)

Same exact thing happens with gcc (but it's actually just calling clang under the hood).

I'm pretty sure I'm just missing one tiny step but for the life of me I can't see what it is right now. Thanks in advance for your help.


Viewing all articles
Browse latest Browse all 22191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>