Importing C++ project in Xcode - c++

How do I import a C/C++ project(NS3, GNU-Radio) to Xcode 7? The main reason I want to do this is to get autocompletion and Quick Help definitions. This can be done in Eclipse by:
File > New > 'Makefile Project with existing code'
It would be nice to have the debugger working as well but not necessary
The answers I have found are mostly for Xcode 4 and seem not to work on Xcode 7
Thanks

The easiest way is to drag and drop all files of the Sources folder into project Navigator of XCode directly from the file browser. That will pop up a wizard to import files into the project. At this point you will need to check the application name into the "add to target" field. Failure to do this would include the files into the project but without actually compiling them.
You do not need to update the include path because the Wizard has already do that for you.
Here is an example: https://www.youtube.com/watch?v=Fqovf9OghSM under OSX if it helps :)

Related

How can I get "go to definition" working in a JUCE project?

I'm trying to get "go to definition" working for a JUCE project created with Projucer. I've tried both CLion and Visual Studio Code, but they can't seem to find definitions that live in the JUCE libraries.
I'm on Ubuntu. Is there a blessed path for this? I'm normally a vim user, but I'm willing to try any IDE.
I've just figured this out!
In VS Code go View and Command Palette and type C/C++: Edit Configurations (UI) which will take to the IntelliSense Configurations page. Under Include path, on a new line, specify the path to JUCE e.g. ~/JUCE/**.
Note: The two stars are needed to tell VS Code to look through subdirectories.
This will create a hidden folder .vscode in your project folder with this configuration.
You will need to repeat these steps for each project you make.
Definitions and code completion should now work.
To compile your code, in your project folder go Builds then LinuxMakefile and in a terminal run the command make. Finally, go to the builds folder and run your project ./exampleProject.
You need to add the JUCE/modules folder to your search path, not the top-level JUCE/ folder!
If you're using the Projucer, you'll also need to add the JuceLibrarySource/ folder to your search path.
What I ended up doing was using FRUT to convert my project from a Projucer project to a CMake project. CLion was able to understand the CMake project, and thus, the "go to definition" and autocomplete features started working.

How to exclude a source file from being build in eclipse (C++)?

I am trying to follow some insane complicated steps in order to be able to create C++ unit-tests for C++ code in eclipse (I am utterly new to eclipse). These steps state to exclude some source files from using in the built - which makes sense to me. However, in my eclipse I do not see any Exclude from built option when right-clicking on the source file. Also, neither this answer nor this answer do work, as I do not see the mentioned options in the list of things when I right-click on the source file.
So how to exclude a source file from a built?
P.S. The Version of eclipse seems to be Luna 4.4.0.
(Or, even better: If anyone knows an easier way to set up eclipse with ANY unit-testing framework in a SIMPLE way,- or knows a different Linux framework to start developing C++ projects with unit-testing right away without trying to set up things in unknown and complicated ways for weeks before starting to actually code something - ideas are VERY VERY welcome...)
I ran into a similar problem.
The C/C++ perspective of Eclipse Luna (4.4) is missing the contextual menu "Exclude from build".
I solve my problem by using the java perpective:
Window -> Open Perspective -> Other... -> Java(default)
Navigate to the file/folder you want to exclude
Right Click -> Resource -> Exclude from build
Then you can switch back to the C/C++ CDT perspective
Project Properties> C/C++ General> Path and Symbols
Tab Source Location
Select the source folder
Click the Edit Filter button
Add the file you want to exclude
I've tried this and it worked on Eclipse:
Right Click the file > Properties ... > Resource > Attributes : Derived.
(Eclipse Indigo)
Hope that helps.
I am using MARS eclipse version.
You have to create a build configuration for each component you are building.
Here is how to do that: multiple_execs
Then for each source file that you do not want included in that build; you right click on that source file and then select Resource Configuration and select Exclude From Build. Then you check the box of the build configuration you created above that you do not want the source a part of.
Here is YouTube video showing this: exclude files from a build

Cannot add test in Netbean C++ project with existing code

So, this is what I have done.
I had a c++ project that I imported in NetBeans. Since the code had its old makefile I made NetBeans use it. I then added the logical folder Test Files (and included cppunit libraries in its linker). If I now try to add a cpp unit test Netbeans complains that I do not have a Makefile and does not let me create the unit test.
The exact error message is:
Makefile is not detected. Test targets will not be added to makefile.
How should I modify my old makefile so that Netbeans will recognize it?
Thanks for the help,
Michele
Additional information
I followed the instruction in http://www.oracle.com/technetwork/articles/servers-storage-dev/howto-add-unittests-ide-1731716.html#About on adding test to an unmanaged project but I cannot understand point 6. What should I add to my makefile? Can someone give me an example?
Right-click on the project name in the Projects pane - you'll get a pop-up menu with first line New, place cursor on this line - another pop-up menu will be opened, left-click on the CppUnit Test... in this menu. You'll get a pop-up window with some settings you can adjust.
After you click Finish in this window the NetBeans will create a directory with test skeletons and add new targets to your Makefile.
Good luck!
I ran into the same problem. It appears in NetBeans you MUST have the Test Package, which is where you would add your unit tests. If you create a C++ Application in NetBeans you will see the Test Package in your project. If you have a project that uses a Makefile that was not generated by NetBeans, then it appears that there is no way to add this Test Package to your project. I would be very happy to be wrong but this has been my experience and from all I have read it appears to be true.

C++ eclipse building error

I'm programming with Galileo on Ubuntu.
My project is compiled through the terminal fine. But for the nice features of eclipse I decided to use eclipse. So I copied and pasted everything inside an eclipse project directory. Then I refreshed the project in the project explorer and everything was found by eclipse. (EDITED) But a red mark (the error mark) is shown on the project icon and when I build the project no binary file is created.
And the last thing is that all the files inside the project have no errors!
what's the problem?
Presumably it is a makefile project. Have you set up the Eclipse IDE to use make with the correct make arguments?
Have you set up the path for the include and lib directories that you need?
Right click on the project in the tree viewer and bring up the preferences dialog and make sure.
There is a console output tab on the Eclipse IDE. What does that say?
There is also a Problems tab that sorts the compiler output. What is on this?
There could well be a problem with building it a a whole project, maybe a link error? More likely it has not been set up properly for eclipse.
Are you using helios? Autotools?

regarding using of Property sheets VS 2008 c++

I am trying to run a project in c++ using visual studio 2008... in vc++ . Now I have a sample project which takes care of the additional included libraries and some other settings... I want to import these settings into my new project. I tried to save the settings of sample project and include them in mine. But I can't see those properties in my new project.
for eg. sample project displays the linker->input->additional dependencies as cv210d.lib cvaux210d.lib highgui210d.lib cxcore210d.lib cvblobslib.lib but the same thing in my new project shows blank...
CAn you please give me the steps for linking properties??
What I did was save the property page and then added existing property page in my new project.. That doesn't help
This is maybe not exactly what you wanted, but you can fix this problem by just copying the stuff you want (cv210d.lib cvaux210d.lib highgui210d.lib cxcore210d.lib cvblobslib.lib) into the blank space in your project. It's editable, you know what should be there, so just go ahead and put it there.
I guess this will only solve one problem (link dependencies) and you want to solve all such problems by importing. How to do the latter i don't know.