Including a dynamic library in an Xcode 4 project - c

I apologise for the basic question. I've searched high an low for a simple answer but I have so far been unsuccessful, so I hope this helps other beginner programmers.
I've installed MacPorts and then installed the external library I was after: ImageMagick. From my research I know that MacPorts put the dylibs in the /opt/local/lib/folder: image. I also know that the header files are located in the /opt/local/include/ImageMagick/ folder.
I thought I'd start with an example program to see how it ran. I made a new project, a C command line tool, then copied the first example into main.c. I now want to add the ImageMagick libraries to my project.
How do I then link the files with my Xcode project so that #include <wand/MagickWand.h> works?

I have similar difficulty with external libraries with iPad projects. Can't seem to make both the simulator and device builds happy. However, for your test case you could try the following:
In the project navigator select your project. Should be top most item.
In the detail pane at the very top you should see a list of tab labels, select the "Build Settings" tab.
Scroll down till you find the "LLVM GCC 4.2 - Language" section.
Find the "Other C Flags", and expand it if needed. You will see two sub items Debug and Release.
For now just modify the Debug item and an include path directive like -
I/opt/local/include/ImageMagick
The above will allow your code to compile, but now you will need to get it to link. You will need to add an additional link option.
In the build settings panel find the "Linking" section.
Within the "Linking" section find the "Other Linker Flags" and expand it if needed.
For now modify the "Debug" sub item. There are couple ways to add your desired library:
With a library search path and library directive as follows
-L/opt/local/lib -lImageMagic
With a full path to library
/opt/local/lib/libImageMagic.dylib (note sure that is the actual file name)
These changes worked for me, at least until I find real XCode 4 way to do it. This is far to clumsy to be the proper approach. Hope some has figured out right way.

Related

How could I get Code::Blocks to show errors as I type for C programs?

I would have thought this would be on by default, don't we pretty much all want that in an IDE.. I've checked all over it's settings for this.
If you could suggest a plugin for Sublime Text to have this ability too, that would be great. My guess is it's all pretty language specific, I know there is Ensime for Scala developers.
First, your second question: ...a plugin for Sublime Text to have this ability too. There is a discussion HERE about that.
The closest thing to IntelliSense for Code::Blocks (that I am aware of) is a feature called Code Completion.
It provides a symbols browser for your projects and code-completion inside the editor. During code-completion, a system of symbols is used to identify the type associated with tokens.
It works with C & C++.
If your version of Code::Blocks is reasonably recent, this feature is already installed. Settings->Editor... will popup a dialog. On the left slide menu, you will see the glyph for Code Completion:
Once there, these options are available for you to select:
Note, there are other items in this same slide menu that may be of interest to you, such as Occurrences Highlighting, SpellChecker, etc.

Using FileChooser in Codename One

I am trying to use FileChooser in cn1.
I have followed the instructions here:
Codename One
and
GitHub
I added the extension and then refreshed my cn1libs
Once this was done I added the code sample to my code but it underlines the word FileChooser in red and gives me the error that it cannot find symbol.
When I hover over the line it asks if I want to create a field called FileChooser
Normally when I add a new lib it will automatically import it - but I do not see an import statement at the top of my code. Perhaps I need the import? If so please can someone give me the path as I do not know whereabouts the actual lib resides?
Any advice is appreciated
Thanks
Check in your project lib folder to ensure the CNFileChooser.cn1lib exists.
If it does exist, clean and build your project to see if this will fix the import.
You could also try Ctrl+Shift+i to fix import on Windows Netbeans or Cmd+Shift+i on Mac Netbeans.
Before you do Refresh cn1lib files, make sure your code is error-free (i.e no red underline). Comment out erroneous codes and uncomment them after the refresh.
Be sure to import com.codename1.ext.filechooser.FileChooser and not javafx.stage.FileChooser.
If the problem persists, kindly share your operating system and IDE details here to get further assistance.

How to pinpoint the source of angular console errors

Note: This question will be changed to eliminate old question with lower rating.
I see AngularJS console errors as follows:
Lexer Error: Unexpected next character at columns 0-0 [#] in expression [#].
The problem now is how to locate the source of this error among thousands of lines of code?
Old Question:
NOTE: This is the old question, please ignore.
I was working with a sample application from ng-flow file upload. I then moved the developed parts to my colleague's environment who is using bootstrap for CSS. I noticed that the look and feel changed on from his environment.
I realized that my colleague is using this css file:
http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
and I am using the css file the came with the download:
http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css
and both work fine, but they have clear differences on how the look and feel and how layout is presented.
I included both, and it seems the application is still working fine, and the look and feel is now merged.
I am just wondering if there is documentation that explains the differences and how to decide which one to use.
Appreciate your feedback.
The reason they look different is that they're referring to different versions of Bootstrap - version 3.3.7 vs version 2.3.2. (The other difference is where the files are hosted.) 3.3.7 is more recent than 2.3.2.
Generally, you want to use the most recent version available for whatever libraries you're including, unless you need to stay compatible with an older one. You shouldn't include both, though; that's going to have your users downloading a lot of redundant css.

Xcode 4 - how does it know what build configuration to use for nested projects?

First time poster, this site is invaluable for answering my questions - so thanks to everyone who contributes!
I have an Xcode 4 project with multiple nested projects (which build as libraries for the main project). Everything is working fine but one step baffles me:
How does it know what configuration to build (and link) for the nested projects? For example my main app has a Distribution configuration. I want it to build and link against the nested projects' Release configurations. And it does!!! but how does it know that? I can't find anywhere where I would specify it.
After scouring the internet to no avail - I'm thinking it might be using magic...
I may have a solution to your question:
If you look at the scheme settings of your included frameworks, they by default have defined Release as configuration to use when you build for Archive. Would be possible that Xcode uses this setting when you build your main project for Archive (and would actually make sense).
(For me this doesn't work, won't find the headers, maybe you have an idea?)

Build custom Extjs for panel

I'm using an extjs panel that shows information that the user can show or hide. Everything works smoothly. But ext-all.js's size is too big and I've been looking around and saw that there is a possibility to customize it to just use the parts you need. I tried the site's "Build your own" but says the page is not found.
Anyone knows how to reduce the size of the ext-all.js? Or build a custom one?
You can build your own extjs with jsbuilder, which is a software (exists in java and in python.
You'll have to modify the .jsb file, in order to manage dependencies. You can look at how the pkgs files are built.
This is quite difficult, though, to find your way through the dependencies.
The command line looks like (on linux) :
java -jar /path/to/JSBuilder2.jar --projectFile $BUILDDIR/ext-lsi.jsb2 --homeDir $DESTDIR
I use it often, it's working well now.
But I'm quite sure this will be another adventure for Ext4.
Links
Sencha Forum about jsbuilder
Tutorial
In your download of ExtJS there is a pkgs directory which contains some prebuilt parts.

Resources