Reputation: 115
I'm developing an ios app that's very basic and uses objective almost all of the time. However my app needs to deal with big integer numbers (eg: 2^200) and add and multiply them. To achieve that I need to include a c++ library called bigint that allows these operations on huge integers. The problem I have is that when I include the bigint project I get many errors and I thought that this could be because it's c++ and can't mix with objective c. I'm new to this idea and was wondering if there are any steps i need to take to correctly add a c++ library to an objective c project. By the way I'm not using opengl or anything complicated just simple ui and some quartz stuff.
Update:
I did everything you guys said, I changed all the extensions to .mm and added the bigint library. My project ran perfectly without errors before doing these things. I get an error when i do this and I get an error even if I don't even add the library. just changing the file extensions to .mm gives me the following error.
This just doesnt make sense since everything ran fine before and I don't have any duplicates in my program. I have no idea why just changing the extensions to .mm could cause this error. Any ideas guys?
Upvotes: 2
Views: 5497
Reputation: 19005
You can mix in C++ files, but use a .cpp suffix for them (and .hpp for their corresponding header files). If you want to mix C++ and Obj-C in the same file, you can do that, but give it a .mm suffix.
Upvotes: 3