Post

Replies

Boosts

Views

Activity

Reply to Swift Project including both C and C++
Progress?I added this search path to my project's TARGETs:myApp:Header Search Paths/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/The "file not found errors" are gone but I'm getting a blizzard of other errors such asUnknown type name "namepace"Unknown type name "template"Expected ';' after top level declarator...and many more.Kinda lost.
Mar ’20
Reply to Swift Project including both C and C++
For the benefit of anyone following, here is some additional background. The solution I need may be hiding in these excellent links but I just can't see it. I feel like I've tried all the permutations of these that I can think of.Can I have Swift, Objective-C, C and C++ files in the same Xcode project?Can I mix Swift with C++? Like the Objective-C .mm fileshttps://www.youtube.com/watch?v=0x6JbiphNS4https://github.com/SwiftArchitect/SO-32541268I'm trying to implement the C++ code from the following project into my Xcode project. I've had success adding a different project in C, but this one in C++ is stumping me.https://github.com/CoolProp/IF97One issue was all the #include files in that project. I added the following search path to my Xcode build settings and this seems to fix the "file not found" errors./Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/How do I cobble this together?
Mar ’20
Reply to Swift Project including both C and C++
"None of your examples use a private, Objective-C header. For that reason, they aren't ever going to work in a real-world project."Can you elaborate on that? I'm specifically working on the Xcode project offered in the fourth, GitHub link. Does your comment apply to that as well? I've contacted the author of that project but no reply yet.I’m sad to say that your reply is over my head. I have never used anything but Swift and so all this hierarchy stuff, headers and includes, is magic to me. I stumbled through adding some C code but I haven't been so lucky with C++.
Mar ’20
Reply to Swift Project including both C and C++
"My advice would be to just rename "IF97.cpp" to "IF97.Swift" and then fix the code. You'll have 10,000 errors until it stops counting, but just go through it and fix them one by one."I though of that. Brute force I understand! My reluctance is from not understanding C++ well enough to accomplish the tranlation but I suppose their are resources I can find to help.How to deal with all those includes?#include <vector> #include <cmath> #include <algorithm> #include <iostream> #include <iomanip> // std::setprecision #include <stdexcept> #include <stdio.h>
Mar ’20
Reply to Swift Project including both C and C++
What do you think of the following approach?Use a Java version of the source code instead ==> sourceforge.net /projects/if97/Use Google's tool to port to Obj-C ==> developers.google.com /j2objcMight be easier than manually porting 5,000 lines of C++ code?[edit] altered the links to get this post out of moderation
Mar ’20
Reply to Swift Project including both C and C++
It was a steep uphill curve, but it worked! I'm flabbergasted that such a tool exists. It converted java source code to Obj-C, which was then relatively easy to incorporate into my Swift app.As a relative noob to all this, I would have had zero chance of success without step-by-step guidance from Tom Ball, the lead of that project. Things like headers, linked librairies and all make my head swim but Tom led me through it all. He must have the patience of a saint. Kudos.
Mar ’20
Reply to Unexpected dictionary behavior
"If you want to iterate through the dictionary in the order defined by its keys, here’s a good way to do that:"Thanks for that but unfortunately my "real" table isn't sorted in any systematic way. It may make perfect sense to the user but not to a sort algorithm. I need to come up with a clever workaround to preserve the order.
Mar ’20
Reply to Unexpected dictionary behavior
"What orginal order do you want to "preserve" ?"Imagine the list above without the leading integers which I used to emphasize the effect. I'd like the order of the animals to remain unchanged. They're in no sorted order except for the unknown user preference.I think I'll just put the list of keys into a separate array at the same time the dictionary is initialized. The user never really sees the dictionary and I can use the list of keys to retain control over the order.I've been reminded by all this that dictionaries are unordered. I remember reading that but now it has hit home. Is there a good reason for that? I mean, it seems like it would always be more useful to have an ordered list than not.
Mar ’20
Reply to How to catch the dreaded "uncaught exception"?
That's exactly what I was doing when the problem was uncovered. I was mapping out how to validate that user inputs are in the proper range, so I could catch them all in Swift and never trigger the exception. The java code documentation describes a range of parameter values but I encountered this problem well inside that range. I've contacted the author.
Apr ’20