Its early in the beta process but, figured I would post since I had so many issues last year with iOS 10. Trying to build my project on Xcode 9 beta for iOS 11 I am getting the following two errors. Any thoughts?
Implicit declaration of function ‘sqlite3_key’ is invalid in C99
Implicit declaration of function ‘sqlite3_rekey’ is invalid in C99
@tcoyle - can you please verify that you have -DSQLITE_HAS_CODEC in the CFLAGS on the top level project or target(s) that are including the sqlite3.h header file?
/Users/user/Documents/APP/Beta/iOS/MyProject/APPSDK/APPDatabase.m:137:5: error: implicit declaration of function ‘sqlite3_key’ is invalid in C99 [-Werror,-Wimplicit-function-declaration]
sqlite3_key(database, key, (int)strlen(key));
^
/Users/user/Documents/APP/Beta/iOS/MyProject/APPSDK/APPDatabase.m:163:9: error: implicit declaration of function ‘sqlite3_rekey’ is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (sqlite3_rekey(database, k, (int)strlen(k)) != SQLITE_OK) {
^
2 errors generated.
@tcoyle I was able to build a reference project using a similar configuration (i.e. SQLCipher via CocoaPods, using Xcode 9 beta, targeting iOS 11 and the 5th generation iPad). There were no build errors, and everything worked smoothly.
Based on our past discussions, I recall that your project is much more complicated, with multiple pod dependencies, configurations, schemes, etc. In this case from your build output, we can see the -DSQLITE_HAS_CODEC, but it is theoretically possible that a sqlite3.h file is being picked up from some other include directory, of which there are numerous.
In order to narrow this down, I would consider adding a header search path explicitly referencing the location of the SQLCipher header above everything else, or adding the .h to your project explicitly, so it is first in line. If that resolves the problem, then it would be helpful to search the other include directories to see if there is a conflicting sqlite3.h present.
A project configuration like this could have been present earlier, but manifested only as a warning whereas now [-Werror,-Wimplicit-function-declaration] is treating it as an error.
I will try those suggestions out and let you know. But just a note: I don’t use SQLCipher via Cocoapods I use it manually adding the SQLCipher project to my project. Not sure if that makes a difference. I’ll try to reproduce myself in a second project as well.
I use cocoapods for all my other dependencies tho.
@sjlombardo I was able to reproduce the issue in a brand new project, with no additional dependencies. All I did was add SQLCipher to the project (via https://www.zetetic.net/sqlcipher/ios-tutorial/), and add the sample code provided.
Hello @tcoyle thanks for the standalone reference. The issue here is the Header Search path. Can you try changing it from $(PROJECT_DIR)/sqlcipher/src to $(PROJECT_DIR)/sqlcipher (i.e. remove the /src from the path). That should allow the sqlite3.h file to be located. It resolves the problem in the sample project, so I would like to see if it fixes the issue in your application build. If so, we will adjust the documentation on the site to reflect as well.
I am facing anther issue with Xcode 9 beta => iOS 11 beta.
Implicit declaration of functions sqlite3_key , sqlite3_rekey invalid in c99
Getting this compiler error while running the project having SQLcipher. I have checked the sqlite3.h header file in Xcode 9 beta. But I didn’t found the above declarations(sqlite3_key , sqlite3_rekey) in the header file.
I am facing this issue only in Xcode 9 beta. My project already have -DSQLITE_HAS_CODEC in CFlags.
Could you please help me in resolving the above errors?
I have the same issue here, when I tried to build my project under Xcode 9 beta 2, when doing build, it reported the same issue as other reported.
I have sqlcipher.a lib file included within my link Binary, I don’t use SQLCipher via Cocoapods, and do not add SQLCipher.project into my project.
I have enabled DSQLITE_HAS_CODEC in other C Flag as well.
my issue is: Implicit declaration of function ‘sqlite3_key’ is invalid in C99
@Jeff_Lu are you including the sqlite3.h file that you got with SQLCipher? If not, you will have that problem. XCode needs to resolve the SQLCipher sqlite3.h file prior to the one from the SDK.
@Jeff_Lu based on the error XCode is either not finding the sqlite3.h file (i.e. because the header search paths are incorrect), or the define is not configured properly. If you would like further help you would need to post the output of ls -R from the top level of your project along with the full Xcode build log out to a GitHub gist and then provide the link here.
I have added DSQLITE_HAS_CODEC" in Other C Flags. But I have linked it properly and I can able to build my project successfully in Xcode 8 and previous versions. But I faced this issue in only Xcode 9 beta versions. I have verified the sqlite3.h file in both versions of Xcode(8 and 9) and found that the methods “sqlite3_key” and “sqlite3_rekey” were not exist in Xcode 9 version of sqlite3.h file. I think that’s why I am getting these errors in Xcode 9 beta.
@YamunaChebolu Yes, that is the reason that the solution referenced earlier in the thread works, and why we have specifically asked about including the sqlite3.h that accompanies the SQLCipher distribution. You need to make sure that SQLCipher’s version of sqlite3.h is include in your project and can be located by the compiler via the Header Search path. This is required in addition to defining -DSQLITE_HAS_CODEC so that the function definitions are present. Please make sure that you are including the proper header file and the issue should be solved.
Thanks for the reply. I have cerated a sample project and still I am facing issue with SQLCipher. I have added SQLCipher to the sample project (via https://www.zetetic.net/sqlcipher/ios-tutorial/8), and add the sample code which having “sqlite3_key” method. But still I am facing the issue.
I am sending you the project via Email. Could please check the settings and please let em know what I am missing in that.