Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » creating C source file in Java project(I have a Java project that uses a C library, I need to create C source files in the project)
creating C source file in Java project [message #1726281] Thu, 10 March 2016 22:32 Go to next message
Eclipse UserFriend
The description states the goal. I am running Mars.1, CDT 8.8.1.201602C on Fedora 23. I need to create C source files. I would prefer to put them into a separate folder/directory from the Java files. I initially tried to create the C source in the Java folder, but couldn't enter an acceptable source folder. In the project explorer window, I have created a native source folder under the project src directory, then R-clicked on that folder to create a C source file. The C file create dialog has an edit field 'Source folder' but I can't get anything to work. No matter what I type in, a message displays that the folder does not exist. Yes, I entered the folder name that I created. I tried a fully qualified name from '/'. I tried putting the folder name in from of the source file name but that didn't work. The finish button is not enabled until I enter a proper folder (it seems), so I can't complete creating my C source. I have checked and there is an empty directory with the folder name that I entered. What do I enter for the source folder? TIA, Chuck Crisler
Re: creating C source file in Java project [message #1726338 is a reply to message #1726281] Fri, 11 March 2016 09:24 Go to previous messageGo to next message
Eclipse UserFriend
If you java project does not have C nature none of C stuff would work afaik
Re: creating C source file in Java project [message #1726412 is a reply to message #1726338] Sat, 12 March 2016 22:32 Go to previous messageGo to next message
Eclipse UserFriend
It seems (though I am not 100% sure) that the environment does support C. The editor seems to recognize all of the C syntax and constructs. The problem is that I can't seem to specify *ANY* directory to create the file in. Nothing seems to work. What should be entered in the directory edit field of the create new source dialog? A relative path? If so, relative to what? An absolute path? Again, eclipse rejected everything that I tried.
Re: creating C source file in Java project [message #1726615 is a reply to message #1726412] Tue, 15 March 2016 02:48 Go to previous message
Eclipse UserFriend
Quote:
It seems (though I am not 100% sure) that the environment does support C


Yes, if you have CDT installed, any project can have a C file that the syntax is highlighted for. If you want advanced features you need the CDT nature on your project. (The inverse applies too, if you have a C project and put a .java file in it, you get syntax highlighting, but no advanced features like code navigation.)

Of course, if you are not an Eclipse developer, you may not know what a "nature" is. A nature is kind of like a project type, and one of the powers of Eclipse is any project can have multiple natures, and therefore support many languages in one go.

However, the flow can be imperfect workflow. To add a CDT nature you need to use the File -> New -> Other -> C/C++ -> Convert to a C/C++ Project (Adds C/C++ Nature) and follow the wizard.

Once you do that you can create a C source file with the wizard and features like indexer/etc will be supported.


Previous Topic:libhover support for /*******//** doxygen comment
Next Topic:Function Arguments
Goto Forum:
  


Current Time: Sat Nov 08 07:29:59 EST 2025

Powered by FUDForum. Page generated in 0.04373 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top