LESS: Unrecognised input "#import ..." - less

I have a really simply LESS file which for now just imports Bootstrap. I'm using grunt and grunt-contrib-less#0.9.0 to compile the LESS files on save (less#1.6.3).
My file looks like this:
#charset "utf-8";
/**
* This is the root style file for the app
* to include styles in your html, you only need to include either:
* dist/styles.dev.css (for development)
* dist/styles.css (for production)
*/
// Libraries
#import "../lib/bootstrap/less/bootstrap"
// Our own files
and I'm getting the following error whenever I try to run my less:dev task.
Running "less:dev" (less) task
>> ParseError: Unrecognised input in style/styles.less on line 10, column 1:
>> 9 // Libraries
>> 10 #import "../lib/bootstrap/less/bootstrap"
>> 11
I've tried removing everything from the file except the import line and it still fails, so something weird is going on with the #import directive.
Any ideas?

Use semi-colon after #import
#import "../lib/bootstrap/less/bootstrap";

Related

Import header files with open: namespace / module error

I don't understand how to work with F# header files.
I have two test files:
Foo.fs:
module Foo
let add a b = a + b
Program.fs:
open Foo
printfn "%d" (add 8 2)
In the file Program.fs, Visual Studio tells me:
Files located in libraries or applications containing multiple files
must start with a namespace or module declaration.
Only the last source file of an
application can omit such a statement.
However, I did the right thing: start my Foo.fs file with a module declaration. If I declare a namespace or module to Program.fs, the error persists. So I don't have access to the add function.
How do I import this file?

Error - 2 duplicate symbols for architecture arm64? [duplicate]

This question already has answers here:
Duplicate symbol error — global constant
(3 answers)
Closed 8 years ago.
I have a BConstants.h file where I put all the constants for my project. The file is the following:
#ifndef asdf_BConstants_h
#define asdf_BConstants_h
typedef NS_ENUM(NSUInteger, BTheme) {
kField
};
typedef NS_ENUM(NSUInteger, BItem) {
kBox
};
typedef NS_ENUM(NSUInteger, BMovementState) {
kTouchUp,
kTouchDown
};
#endif
When I add the following three lines to this file, I receive the subsequent errors when the file is #imported to another .m file
...
NSString * const kHero = #"Hero";
NSString * const kCount = #"Count";
#endif
Errors:
duplicate symbol _kHero in:
...list of .o files
duplicate symbol kCount in:
...list of .o files
2 duplicate symbols for architecture arm64
I have looked at questions already post on SO that state I may have duplicate files in my compile sources of the application target, but I checked and I found no duplicate files. Where else can this problem stem from, is it the inclusion of those 2 NSString constants in the BConstants.h file?
There are 2 other possibilities for this error besides duplicate files
You may importing .m file instead of .h by mistake
Constants kHero and kCount already defined in some other files. As
you are defining those constants in constant file then just import
that file in Prefix.pch file and remove from everywhere else.

How do I get XCode to build a project with Objective-C++ in it?

I added the Scintilla framework successfully to my XCode project (i.e. it finds the header files correctly), but because it is written in Objective-C++ it doesn't compile. I get 8 syntax errors because of ::s. I already found you can't include Objective-C++ from a pure Objective-C file, so I changed the file extension to mm. It still gives me the same 8 errors.
I also changed the file type (of the importing file) to sourcecode.cpp.objcpp.
The relevant lines of code (with the errors in comments - the line numbers are from the original file, so without the errors in the comments):
ScintillaView.h
// Line 47-49
#protocol ScintillaNotificationProtocol
- (void)notification: (Scintilla::SCNotification*)notification; // 4 errors on this line:
// 1. expected type-specifier
// 2. expected ')'
// 3. expected identifier
// 4. expected ';'
#end
// [snip]
// Line 131
- (void) notification: (Scintilla::SCNotification*) notification; // The exact same errors.
When copying this code I noticed the :: operator is used a few more times in the file, so somehow the parser is only able to match it succesfully in certain places.
Once more, this code is not mine, but taken from the Scintilla Cocoa Library.
(See here for more info: http://www.scintilla.org/)
XCode 3.2.6, Mac OS X 10.6.8
Adding
typedef tdSCNotification Scintilla::SCNotification
Before the first offending line revealed that there was no type called SCNotification in that namespace. So I searched through the included header files (which, luckily, count only three) for namespace Scintilla {. It was in the first included header file, Scintilla.h. But it looked like this:
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
and
#ifdef SCI_NAMESPACE
}
#endif
So I assumed SCI_NAMESPACE wasn't defined. I added #define SCI_NAMESPACE to Scintilla.h somewhere online 45 and it worked. Almost. I got another error message:
Framework not found Scintilla
Command /Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
I think this has to do with how I added the framework to my project, so it should be a separate question.

Can Adobe .jsx scripts include other script files?

We're writing a bunch of .jsx scripts and in each I have to mock out some functions so I can use things like Array.map() and String.trim(), but I don't want to have to include that code at the top of every script.
Is there a way to "include" other .jsx scripts inside of a .jsx script file?
Or you can simply use #include and #includepath preprocessor directives at the top of your script.
You can find a detailed description in Adobe's "JavaScript Tools Guide".
For example, if you want to include scripts/helper.jsx in a .jsx file:
#include "scripts/helpers.jsx"
// the rest of your code below ...
Just leaving this here for anyone like me who is looking for this. In Adobe Illustrator CC 2015, I was unable to get #include to work, but #include did. So for example:
External File: foo.jsx
function alertTheWordNo(){
alert('NO');
}
The Script File: bar.jsx
//#include 'foo.jsx';
alertTheWordNo();
Disclaimer: I cannot find any documentation of this but have tested it with Adobe Illustrator CC 2015 and it works.
Hope this helps someone. If anyone has any questions just ask!
We're now using the $ helper available in Illustrator, and the $.evalFile() method. Pass it a path and it will evaluate the file and return the result.
I created a little helper that I can include (minified, of course) at the top of my .jsx scripts so I can do Libraries.include("my-other-script") that will include, in my case, a file that's in my adobe_scripts root folder, in a directory called lib.
// indexOf polyfill from https://gist.github.com/atk/1034425
[].indexOf||(Array.prototype.indexOf=function(a,b,c){for(c=this.length,b=(c+~~b)%c;b<c&&(!(b in this)||this[b]!==a);b++);return b^c?b:-1;});
var Libraries = (function (libPath) {
return {
include: function (path) {
if (!path.match(/\.jsx$/i)) {
path = path + ".jsx";
}
return $.evalFile(libPath + path);
}
};
})($.fileName.split("/").splice(0, $.fileName.split("/").indexOf("adobe_scripts") + 1).join("/") + "/lib/");
Minified version that I include:
/**
* Libraries.include(path) -- path must be relative to adobe_scripts/lib/
* See: https://gist.github.com/jasonrhodes/5286526
*/
[].indexOf||(Array.prototype.indexOf=function(a,b,c){for(c=this.length,b=(c+~~b)%c;b<c&&(!(b in this)||this[b]!==a);b++);return b^c?b:-1;});var Libraries=function(a){return{include:function(b){return b.match(/\.jsx$/i)||(b+=".jsx"),$.evalFile(a+b)}}}($.fileName.split("/").splice(0,$.fileName.split("/").indexOf("adobe_scripts")+1).join("/")+"/lib/");
See gist here: https://gist.github.com/jasonrhodes/5286526
Just wanted to add a note to Ike10's answer. Undocumented is generous - this is the worst "documentation" I've ever come across in 20+ years of writing code. It seems to me that you must also add the CEFCommandLine argument to your manifest.xml file before the primary JSX file will load/eval external files:
<Resources>
<MainPath>./whatever.html</MainPath>
<ScriptPath>./jsx/whatever.jsx</ScriptPath>
<CEFCommandLine>
<Parameter>--allow-file-access</Parameter>
<Parameter>--allow-file-access-from-files</Parameter>
</CEFCommandLine>
</Resources>

Objective-C: headerdoc2html doesn't generate the documentation for protocol

I tried to generate documentations by headerdoc2html command.
But headerdoc only generates toc.html. There is not index.html for the protocol.
Something wrong?
I used following header file and command.
/*!
#header Dummy.h
hoge
*/
/*!
#class Foo
asdf
*/
#interface Foo : NSObject
/*!
#abstract xxx
*/
- (void)xxx;
#end
/*!
#protocol BarDelegate
*/
#protocol BarDelegate
/*!
#abstract Sent after something
*/
- (void)didSomething:(Foo *)foo;
#end
--
$ headerdoc2html *.h -o doc
The result was,
$ find doc
doc
doc/Dummy_h
doc/Dummy_h/Classes
doc/Dummy_h/Classes/Foo
doc/Dummy_h/Classes/Foo/index.html
doc/Dummy_h/Classes/Foo/toc.html
doc/Dummy_h/index.html
doc/Dummy_h/Protocols
doc/Dummy_h/Protocols/BarDelegate
doc/Dummy_h/Protocols/BarDelegate/toc.html
doc/Dummy_h/toc.html
I feel that your code is perfect but when it come for commad which are wrong. Their are four steps to create the headerDoc.
Step 1 : Go to the directory where your project is located (In stead of the header file what you did).
$ cd <Your_Project_Directory>
Step 2 : Now create HTML DOC files of your project's all controller and create a directory to where you will going to generate your HTML DOC file.
<Your_Project_Directory> $ headerdoc2html -o <DIR_PATH_TO_CREATE_YOUR_DOC> <PROJECT_NAME>
Step 3 : Now you will see their are stuff created in the directory path where you are created your doc file. Don't think to much about that We will see it later. Now go to the directory where you created your HTML files
<Your_Project_Directory> $ cd <DIR_PATH_TO_CREATE_YOUR_DOC>
Step 4 : Their are so many files right now in the your directory and all them are separated with each other so to make it together and create link with each other you have to apply the last command.
gatherheaderdoc ..
Here last '..'(Two dots) will create "masterTOC.HTML" file to the parent file. Now you can open this and test your project.