Reputation: 3918
I've manage to make my Android Project work with a Visual Studio project. The only problem I have is when I compiled the c++ project the vsc++ compiler gives me this error:
android-ndk-r6b\platforms\android-9\arch-x86\usr\include\sys\cdefs.h(252): fatal error C1189: #error : "No function renaming possible"
If anyone had this problem before, any input would be nice.
The error happens when I include the .h that contains includes to those files
EDIT :
I've looked at cdefs.h around line 252 :
245 | #if !defined(_STANDALONE) && !defined(_KERNEL)
246 | #ifdef __GNUC__
247 | #define __RENAME(x) ___RENAME(x)
248 | #else
249 | #ifdef __lint__
250 | #define __RENAME(x) __symbolrename(x)
251 | #else
252 | #error "No function renaming possible"
253 | #endif /* __lint__ */
254 | #endif /* __GNUC__ */
255 | #else /* _STANDALONE || _KERNEL */
256 | #define __RENAME(x) no renaming in kernel or standalone environment
257 | #endif
But honestly, I'm not sure what no renaming... means.
Upvotes: 1
Views: 1624
Reputation: 868
I wanted to do the same thing, compile my Android code using Visual Studio. Even though Studio has no tablet emulator, I could at least run some of my logic under Studio, the parts that do not involve anything specific to Android (e.g. UI drawing). Why bother with such a limited dev environment? Well, simply because Studio has a very nice C++ editor and it compiles much more quickly then Android Studio/Gradle. And I have a lot of non-UI logic that I need to get right. So I'm dividing my work into a pre-step, which I think can be done more quickly with Studio.
For me, I copied over jni.h (from android NDK's x86 folder). And I made some tweaks...
#define __NDK_FPABI__
//#include <sys/cdefs.h>
...
#define JNIEXPORT //gdh: __attribute__ ((visibility ("default")))
That made Studio happy.
Upvotes: 0
Reputation: 11
It seems that cdefs.h
from $(NDKROOT)/.../includes
somehow conflicts with the "default" cdefs.h
from Visual Studio. Try to directly address the folder android
in your includes and change #include <android/log.h>
to #include <log.h>
in your source file.
Regarding the jni.h
I have no further clue...
Upvotes: 1
Reputation: 33599
There is #error
pragma in the source code. Find this pragma and explore it's vicinity to check for any comments and / or #ifdef
that might give you a hint on what's the problem.
Upvotes: 0