| Summary: | CDT fails to parse JNI code | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Bryan Hunt <bhunt> | ||||
| Component: | cdt-parser | Assignee: | Project Inbox <cdt-parser-inbox> | ||||
| Status: | RESOLVED INVALID | QA Contact: | Markus Schorn <mschorn.eclipse> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, jansch1991, Knasher, malaperle, mr.sunny.narula, yevshif | ||||
| Version: | 8.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Bryan Hunt
Most likely the parser cannot resolve the included file. You need to configure the include search path in the project properties 'C/C++ General - Paths & Symbols'. I have the include path set. If it's not set, I get an "Unresolved inclusion" on the #include. When the path is set, the #include resolves, but the code has parse errors. This code parses for me on Mac. Try reindexing the project maybe? And occasionally, when I open my workspace, my opened file will be full of syntax errors. I just close it and reopen then it's fine. Is it possible that the editor reconciles before the index is setup? Please create a parser log for the test file ocntaining the syntax error. You can do that from the context menu of the file in the project explorer: 'Index - Create Parser Log' No response from submitter. I had this same problem when I moved my project over to Linux. As it turns out the problem is due to fact that java on linux splits the jni headers over two directories %JAVA_HOME%/include and %JAVA_HOME%/include/linux and jni.h references headers in the second folder. The resolution is to just add the second folder to your includes. I am currently expiriencing this problem on windows i did not make a system switch the specific errors are : Method 'NewStringUTF' could not be resolved com_example_myproject_MainActivity.c /MyProject/jni line 7 Semantic Error Type 'JNICALL' could not be resolved com_example_myproject_MainActivity.h /MyProject/jni line 15 Semantic Error i originally also had the unresolved include on #include <jni.h> which i solved by adding the directories of the inlude folder of JDK in eclipse c/c++ preferences any help would be greatly appreciated. I have not tried reindexing because i am new to eclipse and have no idea how to do it or what it does thanks, Jan Method 'NewStringUTF' could not be resolved com_example_myproject_MainActivity.c /MyProject/jni line 7 Semantic Error Edit: was fixed by changing my notation to c++ inside a cpp file(which wasnt so before) Solved My tutorial neglected to mention some extra includes, apparently in their version of the ndk and eclipse these include can be added later thanks anyhow I found this bug while searching it does exist. Even after resolving the correct paths eclipse cdt shows an error on the jni method signature line reporting a general syntax error. Please reopen this bug. Created attachment 229419 [details]
Proof of cdt error message
(In reply to comment #10) > I found this bug while searching it does exist. Even after resolving the > correct paths eclipse cdt shows an error on the jni method signature line > reporting a general syntax error. Please reopen this bug. I can't reproduce this. I'm running Mac OS X 10.8.3 and Eclipse 3.8.2 with CDT 8.1.2, java version "1.6.0_43". Could you describe your setup? Could you add a parser log? See Markus's comment 4. I added this path to my includes to get it to resolve jni.h: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/ |