GH-Unit and Objective C ++

I have an iPhone project that uses GHUnit to do unit testing. Recently, I need to implement complex numbers and overload some operators to facilitate FFT computation. The goal here was to create a clean way to execute FFT without the overhead of all the possible functions that libraries use, such as using FFTW, and in that sense I could further customize the amount of calculations that I would like to do in my FFT ( therefore, I reduce the complexity of factorizing this or that used in traditional DFT).

In short, so I decided to implement my own FFT library in C ++, rather than using FFTW. However, this caused some problems with GHUnit. All my production goals work correctly with the integration of my FFT library, but GHUnit refuses to work. In particular, I get linker errors with things like GHComposeString. This only happens in my targeted Unit Tests program. I wonder what the problem is? At first I suspected that this might be due to differences in C vs C ++ in how the function names are distorted, but it does not seem to affect the rest of the project, but only part of GHUnit.

Any help with C ++ mixing with GHUnit evaluation.

+3
source share
4 answers

, , mangling. Mangling . GHUnit, OCUnit, dyld. , GHUnit/OCUnit Obj-++.

0

GHUnit extern "C" ?

.

, , ++:

#ifdef __cplusplus
extern "C" {
#endif

...// other content here

#ifdef __cplusplus
}  // end of scope of extern "C"
#endif
0

() , , , .m ( ) Obj-C, .mm Obj-++.

, (Obj-C (++) cpp), , iPhone ( iOS), , .

Double check that your Obj-C test files that use your FFT class have a .mm and not a .m extension.

0
source

Add -lstdc++to the “Other Linker Flags” in the test target.

0
source

Source: https://habr.com/ru/post/1722726/


All Articles