danomatika / ofxLua

(maintained) a lua scripting interface & bindings for openFrameworks
Other
164 stars 36 forks source link

Semantic issue: ofxLuaBindings.cpp No viable overloaded '=' #65

Closed murilopolese closed 3 years ago

murilopolese commented 3 years ago

Hello! This is such a cool project, thanks for sharing it! 🙏

I'm following the README.md to install and run this addon but I'm bumping on an error. My computer is a macbook, I run macOS Mojave Version 10.14.6 (18G87). I have XCode Version 10.2.1 (10E1001) installed and openFrameworks Version 0.11.0.

Here's exactly what I'm doing:

Install the add on

$ cd of_v0.11.0_osx_release/addons
$ git clone git://github.com/danomatika/ofxLua.git
$ cd ofxLua
$ git checkout 1.3.0

Note: checking out '1.3.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at d792bb7 updated changelog, bump to 1.3.0
$ git submodule init
Submodule 'swig' (https://github.com/danomatika/swig-openframeworks.git) registered for path 'swig'
$ git submodule update
Cloning into 'of_v0.11.0_osx_release/addons/ofxLua/swig'...
Submodule path 'swig': checked out 'e67c8ce805d8cb62d2560c47ed25d8f7c9582fb9'

Import project example

  1. Project generator
  2. Import addons/ofxLua folder
  3. Open on IDE
  4. Build

Error:

of_v0.11.0_osx_release/addons/ofxLua/src/bindings/desktop/ofxLuaBindings.cpp:46581:70: No viable overloaded '='
    of_v0.11.0_osx_release/addons/ofxLua/src/bindings/desktop/ofxLuaBindings.cpp:34:21: Candidate function not viable: no known conversion from 'Range<ofXmlAttributeIterator>' to 'const SwigValueWrapper<ofXml::Range<ofXmlIterator<pugi::xml_attribute_iterator> > >' for 1st argument
    of_v0.11.0_osx_release/addons/ofxLua/src/bindings/desktop/ofxLuaBindings.cpp:38:21: Candidate function not viable: no known conversion from 'Range<ofXmlAttributeIterator>' to 'const Range<ofXmlIterator<pugi::xml_attribute_iterator>>' for 1st argument

This error message is very cryptic to me, I'm also not very experienced with this. Any ideas how could I fix this error?

danomatika commented 3 years ago

Try a newer version, starting with 1.4.3 as 1.3.0 is too old and the bindings are for OF 0.10.0.

murilopolese commented 3 years ago

Woah! Thanks for such a quick reply!!!

Just checked out and updated submodules:

$ git checkout 1.4.3
$ git submodules update

The build now fails differently:

ld: warning: object file (../../../libs/rtAudio/lib/osx/rtaudio.a(RtAudio.o)) was built for newer OSX version (10.11) than being linked (10.9)
Undefined symbols for architecture x86_64:
  "luaL_newstate()", referenced from:
      ofApp::setup() in ofApp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This looks less cryptic but I'm still clueless of what-how to rebuild to the correct version :s hehe

danomatika commented 3 years ago

Clean the Xcode project as the old build is left over, then rebuild.

danomatika commented 3 years ago

You may also need to regenerate the project files after switching tags.

murilopolese commented 3 years ago

I have started from scratch, cloned again the addon, checked out, initialised and updated submodules, created a new project with ofxLua as addon and now I get a Thread 1: EXC_BAD_ACCESS (code=1, address=0x1) D:

Screenshot 2021-06-01 at 16 06 47

Is this still old build left over?

danomatika commented 3 years ago

Run in Release mode. It's a low level problem we don't have a solution for: #58.

murilopolese commented 3 years ago

Thank you! Does compile! Also got to run the graphicsExample with some adjustments.

If I declare my ofApp like:

class ofApp : public ofBaseApp, ofxLuaListener {

It gives me an error:

ld: warning: object file (../../../libs/rtAudio/lib/osx/rtaudio.a(RtAudio.o)) was built for newer OSX version (10.11) than being linked (10.9)
Undefined symbols for architecture x86_64:
  "ofApp::errorReceived(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)", referenced from:
      vtable for ofApp in ofApp.o
  "non-virtual thunk to ofApp::errorReceived(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)", referenced from:
      vtable for ofApp in ofApp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think this solves the problem for now, but out of curiosity, do you know what is the deal with this error? :)

danomatika commented 3 years ago

You need to implement the errorRecieved function in your ofApp. The compiler is saying "I see you are subclassing ofxLuaListener but your subclass is missing the required errorReceieved function in it's implementation."

murilopolese commented 3 years ago

THAT WAS IT! I feel a bit embarassed, sorry! Thank you very much, this pretty much nails it! ⭐ Long live @danomatika 🙌

danomatika commented 3 years ago

Good luck. Lua is fun with OF, although you will need to know the OF API to some degree to use the bindings.

danomatika commented 3 years ago

If you just want to experiment with Lua + OF directly and don't need to build a custom app, try loaf: http://danomatika.com/code/loaf

murilopolese commented 3 years ago

This is perfect! 🤩 ❤️ I'm looking into an in-app text editor and eventually using LUA as an intermediary language for a visual language. Without your work I would be 10 years late 😂 Thank you!

danomatika commented 3 years ago

You may want https://github.com/Akira-Hayasaka/ofxGLEditor

I built a live coding Lua editor using ofxGLEditor & ofxLua but in the end I find working in a separate text editor better. The older project is here if you want to see how the various parts are integrated: https://github.com/danomatika/Visual

danomatika commented 3 years ago

Old video demo: https://vimeo.com/116370247

murilopolese commented 3 years ago

The door to so many possibilities just opened in front of my eyes, I need to take a deep breath, try out all your links and reevaluate because you showed me things much more interesting than my initial quest! hahaha 🙏