Adding external libraries on CodeLite - external

I'm starting with CodeLite and I wonder how do I add an external library. I wanna make a SFML game using CodeLite and I'm getting some troubles with it. I used to program with QtCreator, but now I'm trying something new.

Right click on the project icon on the left side (in the tree view) and select 'settings->common settings->linker'
There you have 2 fields:
Library paths and libraries, in the first one, place the path to your library and in the later, place the name of the library (you can omit the prefix and extension)
Eran

Related

How to include software in PhpStorm project

I have just started using PhpStorm. In my project I am receiving a lot of undefined variable errors because I am creating a plugin for vBulletin.
I was wondering is there a way to include the main software I am working with in my plugin development, to avoid getting undefined vars, and functions? Kind of how the WordPress plugin development works.
For example I have my projects folder: c://wamp/www/projects/projectname/ and I have vBulletin in c://wamp/www/vb3/
I want to be able to tell PhpStorm "hey the core scripts to this project are here".
As LazyOne said I was able to achieve this using include paths.
Include paths are used for holding third-party code that is used for completion and reference resolution in some functions/methods that use file paths as arguments, for example, require() or include().
Note that the files added via include paths are not meant to be edited within the scope of your project. If you have the existing code that you need to access and modify from within several projects, consider adding it via an additional content root.
Do one of the following:
To configure the include paths for the current project, in the
Settings/Preferences dialog Ctrl+Alt+S, click PHP under Languages &
Frameworks.
To configure the include paths that will be applied to all newly
created projects, use the default new project settings (File | New
Projects Settings | Settings for New Projects ).
On the PHP page that opens, configure the list of include paths on the Include path tab:
Use Add and Remove to add and remove paths.
Use Move up and Move down to reorder the items in the list.
Click the Sort Alphabetically button to sort the paths alphabetically in the ascending order.

PhpStorm: multiple projects with common core

Due to security reasons, I have to split one project to divisions (client, admin, ...), and deploy them to different web servers. These divisions have one common script base, but each division has its own functions. As an IDE I use PhpStorm.
The question: what is the best way to organize project's structure and settings, so the common core part will be visible for IDE indexing in all project's divisions, but at the same time, being maintained from a single project (perhaps, standalone)?
In Java you can do lib jar files for further linking in various projects.
But how it can be done in PHP?
There are multiple ways of how to reference extra PHP code in a project.
If you plan to actively edit such extra code in the same project (and want to see their TODOs, code inspection warnings, include references in code refactoring etc):
You can just add it as an additional Content Root: Settings/Preferences | Directories. Folder added this way will be treated as a part of the project itself and will be shown as a separate node in the Project View panel (just as the main code, which is a Content Root as well).
Or you can open 2nd project while 1st one is already opened and when asked, just chose "Attach":
It's not going to be full 2 projects in one frame, more like something in between attaching Content Root and having 2 projects opened in separate frames.
https://www.jetbrains.com/help/phpstorm/opening-multiple-projects.html
Simple symlink will also do the job (but you need to place it somewhere in a project, e.g. PROJECT_ROOT/libs/my_symlinked_code). You then will need to provide a path mapping for that folder for debugger (if you will debug it of course) as PHP/Xdebug works with "final/resolved path" while IDE works with the path as is.
If you do not need to actively edit that extra code in the same window (and ignore any TODOs, code inspection warnings and other inspection results etc):
Do it as a composer package then? Composer can use custom sources (e.g. GitHub repo or a folder on a local filesystem).
Just add the path to that folder as a "Include Path" at Settings/Preferences | Languages & Frameworks | PHP --> Include Path tab. Code referenced this way is meant for 3rd party libraries (the code that you just use but not edit, e.g. framework code, your send mail/ORM library etc). Composer packages will also be included here by default.
https://www.jetbrains.com/help/phpstorm/php.html#include-path-tab

Sharing source between 2 projects?

I have a project containing a big package "global" of classes which is designed for Web, I need to share these classes with a new mobile project, but when i add them with :
Properties -> Flex Build Path -> Source path -> Add Folder
they start appearing with index [source path] before the package name, and since them Flash Builder start trowing error messages :
"A file found in a source-path must have the same package structure '', as the definition's package, 'global'."
How can i fix this issue ?
As we've discussed in the comments, I think it would be a better approach to compile your "global" classes into a library (.swc).
You were concerned about loading unnecessary classes: when you link to a library as 'merged', only the classes you use are actually compiled into the main application (and any classes they depend on), so there's no need to worry about that.
As a last argument I also think this is a more flexible approach. A compiled library is easier to reuse and version, so the code can more easily be distributed to other developers on your team.
Rename one of the packages with right click->refactor. Than is should work.
If not you can also try to have your two codes available at the same project, and then you can select which to run in Flash Builder, by right-clicking to that .as or .mxml file, and selecting set as ... (or something like that)
I guess if you will include 'src' fonder instead of 'src/global' that problem will disappear.

how access actionscript file in a different project?

I have two ActionScript projects in Flash Builder 4.5. The second project needs to use some of the actionscript files in the first project. Is there a way to do this without duplicating those files in the second folder? Is library project the answer? Any details appreciated.
I use Library projects for this type of sharing. It works well.
Create a new library project
File -> New -> Flex Lilbrary Project
Any files that you want to be shared can go into that project. I tend to organize it by folder, depending on what the classes do. (example: Views, Models, DTOs, Utilities, etc).
The output will be a SWC file in the bin folder.
Manually referencing the library project
If you aren't actively developing the library project, you can build it and drop it into the libs folder and use the classes like you normally would.
If you are like me and you are constantly working on the library projects, then I like to set it up so that the projects actually reference each other in a way that changes to the library project don't require a manual step.
Automatically referencing the library project
In the project that wants to reference the library project, do the following:
Go to Project Properties -> Flex Build Path -> Add SWC Folder
Add /LibraryProjectName/bin
Go to Project Properties -> Project References
Select the library project
That's it
Once you set it up this way, you can share files via the library project. I do this all the time. Reasons you might want to do this:
Library Project: MyProject.Behavior
Web Project: MyProject.Web
Mobile Project: MyProject.Mobile
Desktop Project: MyProject.Desktop
Administrator Desktop Project: MyProject.Administrator
Testing: MyProject.Specs
As you can see, I can have several projects that all use the same behavior (models, views, etc).
you can make a library project, and add this output library file into library of used project, and add this library used project by adding library in Eclipse.
Making library project sample:
http://cookbooks.adobe.com/post_Creating_a_Flex_Library_Project_in_Flash_Builder-17629.html
Or
you can share reference of the library project by adding reference project in Eclipse, it works fine to me.
HTH.

Adding an external jar library to Intellij IDEA

I'm having a silly problem : I'm trying to add the Jsoup library (which is just an external jar) to my android application developed in Intellij Idea and it seems and don't do it right .
I put the library in the libs folder , then I went in Project Structure -> modules and selected dependencies , select add global library , select attach source and click ok.
When I write code it is able to automatically import classes and to compile , but when running I get " java.lang.NoClassDefFoundError: org.jsoup.Jsoup"
Copy the .jar file into your lib/ directory.
Right click the new .jar in the lefthand file browser in IntelliJ / Android Studio
Choose "Add as Library..."
Voila!
-Open the External Libraries node on the Left hand panel.
-Select Open Library Settings
-Project structure dialogue opens up.
Select the Libraries.
Click the "+" to browse the file.
![add external jar1
In IntelliJ IDEA 15 you can also access the Project Structure menu item from "File" item in the menu bar. Select Libraries from the list on the left. Click the "+" to browse the file, select it and you're done. It will be added to the "External Libraries" directory in your project.
Have a look at the newer artifacts section. Perhaps you don't add the JAR into your deployment properly.
UPDATE:
I'd like to update my answer based on lessons learned over the past six years since I first answered this question.
The best way to manage 3rd party JAR dependencies in Java projects is to learn Maven (my preference) or Gradle. IntelliJ has terrific integration with both.
If you combine those with an enterprise repository like Nexus you'll have no problems. Your dependencies and versions will be completely specified. Conflicts will be identified for you. Updates will be relatively simple.