Openframeworks and sublime 2


#41

hey tim :slight_smile:

yeah, I thought so. But on the other hand it is amazing what kind of sublime addons are floating around on github…


#42

Hi,

I just discovered Sublime Text 2 and I’m giving it a try to develop my of-apps with it. I managed to make it work alright, but autocompletion is not working for the addons. Is there a way to solve this? I tried both tgfrerer’s and james’ .sublime-project files.

I’m on OSX 10.8

Cheers!


#43

Hi!
I’m trying to make it run on my machine (OSX 10.9.2, OF 0.8.1) but I had no success. I’ve changed all the paths like that:

{
	"folders":
	[
		{
			"path": "/Users/fanta/Code/of_v0.8.1_osx_release/apps/Sublime/OFProject-template-master"
		},
		{
			"path": "/Users/fanta/Code/of_v0.8.1_osx_release/libs/openFrameworks"
		}
	],
	"settings":
	{
		"add_language_option": true,
		"additional_language_options":
		{
			"c":
			[
			],
			"c++":
			[
				"-std=c++11"
			],
			"objc":
			[
			],
			"objc++":
			[
			]
		},
		"sublimeclang_enable_fast_completions": true,
		"sublimeclang_options":
		[
			"-Wno-deprecated-declarations",
			"-Isystem",
			"-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/",
			"-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/",
			"-I/Users/fanta/Code/of_v0.8.1_osx_release/libs/**",
			"-I/Users/fanta/Code/of_v0.8.1_osx_release/addons/**",
			"-I${folder:${project_path:OFProjects.sublime-project}}/src/**"
		]
	}
}

And then I get this error:

    clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated
/Users/fanta/Code/of_v0.8.1_osx_release/apps/Sublime/OFProject-template-master/src/App.h:25:9: warning: #pragma once in main file
#pragma once
        ^
In file included from /Users/fanta/Code/of_v0.8.1_osx_release/apps/Sublime/OFProject-template-master/src/App.h:27:
/Users/fanta/Code/of_v0.8.1_osx_release/apps/Sublime/OFProject-template-master/src/aLib/aUtil.h:31:10: fatal error: 'ofMain.h' file not found
#include "ofMain.h"
         ^
1 warning and 1 error generated.
[Finished in 0.3s with exit code 1]

Am I missing something??
Thanks


#44

I’ve been using the linux template with ST2, compiling on both Ubuntu and OS X.

I’ve put my build script and sublime-build here:


#45

im still trying to get sublime text to build a debug. still having some trouble with it. any pointers. using latest mavericks

but how about without having xcode on the computer? is this possible?
though on quick thought, you would miss that ability to do other things with say, ios or something similar

just a thought


#46

I build on the command lines as I don’t like the sublime console for output.

make Debug

Does the job. You will probably need to have Xcode command line tools (requires Apple Developer account -free), but not necessarily Xcode itself.


#47

Hey everyone,

I’m new to OpenFrameworks and I’d really like to use it with Sublime, so I’m really grateful for the work you all have put into this! The build system works great. :slight_smile:

That said, I’m having problems getting SublimeClang working. It seems to have trouble finding classes and files that are outside of my project (like “vector” and “ofMain”). I’m getting errors like this:

Fatal - ‘vector’ file not found
Did you configure the include path used by clang properly?
See http://github.com/quarnster/SublimeClang for more details on how to configure SublimeClang.

Unfortunately, the github page doesn’t have info on how to configure clang’s include path… Any help?

I’m using these options in my project file:

		"sublimeclang_options":
	[
	    "-std=c++11",  
		"-Wno-deprecated-declarations",
		"-Isystem",
		"-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/",	// this gives us access to the system headers
		"-I../../../libs/**",			// this adds openFrameworks core
		"-I./src/**",					// this adds local header files, if you happen to have some in a subdir of your local src directory
		"-I../../../addons/**"
	]

I should also mention I’m on a Mac, and looking in my XCode app I have MacOSX10.8.sdk and MacOSX10.9.sdk.


#48

I’ve made some progress by including absolute paths instead of relative ones:

		"-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/", 
		"-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/",	// this gives us access to the system headers
		"-I/Users/adamrossledoux/Code/C++/of_v0.8.1_osx_release/libs/**",
		"-I/Users/adamrossledoux/Code/C++/of_v0.8.1_osx_release/addons/**",

I’m getting code completion for oF objects and vector. But I still get the same error messages, even though everything seems to be working.

/Users/adamrossledoux/Code/C++/of_v0.8.1_osx_release/apps/myApps/polygonDraw/src/ofApp.h:4,17 - Warning - using directive refers to implicitly-defined namespace ‘std’

/Users/adamrossledoux/Code/C++/of_v0.8.1_osx_release/libs/glew/include/GL/glew.h:1170,10 - Fatal - ‘OpenGL/glu.h’ file not found
Did you configure the include path used by clang properly?
See http://github.com/quarnster/SublimeClang for more details on how to configure SublimeClang.


#49

Is possible to do the samething in windows? I mean, configuring codeblocks/visual studio first, and then, moving it to sublime?


#50

sorry to bump up this old post. but what i am trying to do still is to build and it nearly get to that point using https://gist.github.com/acarabott/11043968

but this is what spits out. i can see the problem, but how do i change the SDK to say MacOSX10.10.sdk instead of MacOSX.sdk?

Compiling OF library for Debug
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../../../libs/openFrameworksCompiled/project/ Debug PLATFORM_OS=Darwin ABIS_TO_COMPILE_DEBUG=""
Compiling ../../../libs/openFrameworks/3d/of3dPrimitives.cpp
c++ -g3 -stdlib=libstdc++ -Wall -fexceptions -march=native -mtune=native -finline-functions -arch i386 -fpascal-strings -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks -mmacosx-version-min= -fasm-blocks -funroll-loops -mssse3 -fmessage-length=0 -D__MACOSX_CORE__ -I../../../libs/FreeImage/include -I../../../libs/cairo/include -I../../../libs/cairo/include/cairo -I../../../libs/cairo/include/libpng15 -I../../../libs/cairo/include/pixman-1 -I../../../libs/fmodex/include -I../../../libs/freetype/include -I../../../libs/freetype/include/freetype2 -I../../../libs/freetype/include/freetype2/freetype -I../../../libs/freetype/include/freetype2/freetype/config -I../../../libs/freetype/include/freetype2/freetype/internal -I../../../libs/freetype/include/freetype2/freetype/internal/services -I../../../libs/glew/include -I../../../libs/glew/include/GL -I../../../libs/glfw/include -I../../../libs/glfw/include/GLFW -I../../../libs/glut/include -I../../../libs/openssl/include -I../../../libs/openssl/include/openssl -I../../../libs/poco/include -I../../../libs/rtAudio/include -I../../../libs/tess2/include -I../../../libs/openFrameworks -I../../../libs/openFrameworks/3d -I../../../libs/openFrameworks/app -I../../../libs/openFrameworks/communication -I../../../libs/openFrameworks/events -I../../../libs/openFrameworks/gl -I../../../libs/openFrameworks/graphics -I../../../libs/openFrameworks/math -I../../../libs/openFrameworks/sound -I../../../libs/openFrameworks/types -I../../../libs/openFrameworks/utils -I../../../libs/openFrameworks/video -DDEBUG -x objective-c++ -MMD -MP -MF ../../../libs/openFrameworksCompiled/lib/osx/obj/Debug/libs/openFrameworks/3d/of3dPrimitives.d -MT../../../libs/openFrameworksCompiled/lib/osx/obj/Debug/libs/openFrameworks/3d/of3dPrimitives.o -o ../../../libs/openFrameworksCompiled/lib/osx/obj/Debug/libs/openFrameworks/3d/of3dPrimitives.o -c ../../../libs/openFrameworks/3d/of3dPrimitives.cpp
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
clang: error: invalid version number in '-mmacosx-version-min='
clang: warning: optimization flag '-finline-functions' is not supported
make[2]: *** [../../../libs/openFrameworksCompiled/lib/osx/obj/Debug/libs/openFrameworks/3d/of3dPrimitives.o] Error 1
make[1]: *** [Debug] Error 2
make: *** [Debug] Error 2

or better still if someone has a working run debug build system, that would be great


#51

I hate to bump such an old thread, but I recently found this useful, and so may someone else.

I had issues building in ST3 on Linux with the build system config given by @jamesacres.
When trying to build+run, Bash returned the error message: error: ./ is a directory.
Evidently, ST3 doesn’t properly expand $project_base_name when “_debug” is appended to the end.
I was able to remedy the issue by modifying the build system like this:

{  
"cmd": ["make", "Debug"],  
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",  
"working_dir": "${project_path:${folder}}",  
"selector": "source.c, source.c++",  

"variants":  
[  
    {  
        "name": "Run",  
        "cmd": ["bash","-c", "cd ${project_path:${folder}}/bin; ./`echo '$project_base_name''_debug' | cat`" ]  
    }  
]  
}  

Furthermore, I recommend that anyone interested in using Openframeworks with Sublime Text take a look at the STProjectMaker plugin. Using that, I am able to create, edit, and build new Openframeworks projects entirely within ST3. What I did was this:

  • Install STProjectMaker from the ST Package Repository

  • Copy the Empty Example project from openframeworks/apps/myApps into a new folder called “Openframeworks Project” in the “Sample Templates” folder created in the Sublime Text Packages directory by STProjectMaker. For me, this is ~/.config/sublime-text-3/Packages/Sample Templates

  • Copy this ST project file into Sample Templates/Openframeworks Project as _project_name_.sublime-project

      {  
      "folders":  
      [  
      	{  
      		"path": "."  
      	}  
      ],  
      "settings":  
      {  
      	"add_language_option": true,  
      	"additional_language_options":  
      	{  
      		"c":  
      		[  
      		],  
      		"c++":  
      		[  
      		],  
      		"objc":  
      		[  
      		],  
      		"objc++":  
      		[  
      		]  
      	},  
      	"sublimeclang_enable_fast_completions": true,  
      	"sublimeclang_options":  
      	[  
      		"-stdlib=libc++",  
      		"-Isystem",  
      		"-I/usr/include/c++/4.8.2/",  
      		"-I/usr/include/c++/4.8.2/x86_64-unknown-linux-gnu/",    
      		"-I/usr/include/c++/4.8.2/ext/",    
      		"-I/usr/include/gstreamer-1.0/",    
      		"-I/usr/include/glib-2.0/",    
      		"-I/usr/lib/glib-2.0/include/",  
      		"-I/usr/include/cairo/",  
      		"-I/home/nam/Development/openframeworks/addons/**",  
      		"-I/home/nam/Development/openframeworks/libs/**",  
      		"-I./src/**"  
      	],  
    
      	"sublimegdb_workingdir": "${project_path}/bin",  
      	"sublimegdb_commandline": "gdb --interpreter=mi ${project_name}_debug"  
      }  
      }  
    
  • Remove the codeblocks project files and rename all instances of “emptyExample.*” to “_project_name_.*”

  • Edit the Makefile and config.make. Be sure to update the path for the $OF_ROOT variable.

You should now be able to create, build, and run new OFX projects from within Sublime Text!

I’ve written up and posted a more detailed set of instructions here.


#52

Bumping up an old thread… as SublimeClang has been discontinued and seemingly replaced by EasyClangComplete, can anyone help me set that up for OpenFramewoks Auto Completion? I followed the instructions and it seems to check the code when opening .h or .cpp files but it doesn’t seem to read either .clang_complete nor the flags I put into the .sublime-project file, so it never knows about all OF libraries… I used the directives from the post above:

    	"-stdlib=libc++",  
		"-Isystem",  
		"-I/usr/include/c++/4.8.2/",  
		"-I/usr/include/c++/4.8.2/x86_64-unknown-linux-gnu/",    
		"-I/usr/include/c++/4.8.2/ext/",    
		"-I/usr/include/gstreamer-1.0/",    
		"-I/usr/include/glib-2.0/",    
		"-I/usr/lib/glib-2.0/include/",  
		"-I/usr/include/cairo/",  
		"-I/home/nam/Development/openframeworks/addons/**",  
		"-I/home/nam/Development/openframeworks/libs/**",  
		"-I./src/**"  

Any help is greatly appreciated. I hope I’m not the only one wanting to have Sublime Text 3 Auto Completion for OF :slight_smile: