C-Chads / tinygl

The penultimate portable graphics library
Other
453 stars 53 forks source link

Error “undefined reference to ‘ZB_open(int, int, int, void*)’” when using Arduino #24

Closed XanCraft21 closed 1 year ago

XanCraft21 commented 1 year ago

Hello, i am having a problem using this library with an IDE that handles functions in an unusual way. The IDE is Arduino because i want to see if i can run this on a strong device like an esp32. I have a compiler error “undefined reference to ‘ZB_open(int, int, int, void*)’”. I don’t know if Arduino was even made to run this library in the first place but i got a bit curious. Arduino runs c++11 and i don’t if this library supports that version. I tried to modify the files but nothing made it work. If anyone knows a way to get past this error please tell me. Thank you for any help you can give me.

XanCraft21 commented 1 year ago

Well the program i was using is an IDE called arduino, and i do not think it is designed to run this library since it uses c++11 as the base coding language.

the organization goes as follows, i include the header files, i create variable for easy control, i write a setup or code that only runs once, i write a main loop, and add the correct commands into the correct functions. I don’t know if this counts but that’s how i understand it.

The thing with the headers is weird because the program would not properly detect some of the header libraries i had to include, even with reference from an existing example demo to get the codes right. Since the program requires a header file in the beginning of the folder, i had to add a dummy header that includes some of the required files then include that into my main code.

maybe there is a compatibility issue since the languages are slightly different. I’m not sure if C99 is compatible with C++11 so it may never work with the program i am using to compile the code. I’ll need to find another way to use this library with the limitations i currently have to deal with at this time.

XanCraft21 commented 1 year ago

I had trouble finding this document. As i can see so far there are no tutorials online. If you are able to help me get things set up correctly or know someone who can i will gladly appreciate the help.

XanCraft21 commented 1 year ago

Thank you for the link. And no i did not publish my project yet because it is not finished.

XanCraft21 commented 1 year ago

I still seem to be having the same problem as mentioned before with the undefined reference. Are you familiar with the arduino platform? It might not be compatible but i want to try more things to be sure.

XanCraft21 commented 1 year ago

I know i have a good structure, your description should be more clear on how to set up. It’s definitely a compatibility problem with the IDE i was using. And this post should be closed as not planned, not completed. It’s like you don’t want to help me, i think testing the same IDE and same packages i used would’ve helped a lot. Well thanks for trying i guess, have a nice day.

XanCraft21 commented 1 year ago

Ok, sorry, let me see here.

The project structure in the IDE i am using is pretty basic. All the code is in a single file, although i can have multiple tabs for each project, but i was only using one tab. The code from this repo is in its own dedicated folder called libraries, where i include it from there in my main code. There’s really not that much to it. I originally needed to modify the file structure of the repo or add a special include file until you sent me that link for the setup document which fixed that.

The code file “main” is ran internally, i just need to fill out a setup function that runs once, then my main loop function.

I am still not too sure why the function isn’t recognized, I believe the IDE isn’t compatible with C99.

XanCraft21 commented 1 year ago

Well thank you for the help you gave me so far. Yes i do have my headers included in my code, if i didn’t include the header the function would not exist according to the compiler.

I have put the code from this repo in a library folder (following the integration instructions) where then i include it in my main code in a separate file, main code goes in one place, the library and headers go to the other.

Also i did not do too much to my code since i wanted to start slow and just start with making the buffer at the beginning, nothing has really been done since i had trouble making the buffer. I will add you on discord and i hope i can get this working soon.

XanCraft21 commented 1 year ago

Hello, sorry it took me so long to get back on this, i have fixed this issue, i had to add a trick to make my compiler recognize C code in a certain file. All is working fine now.

I am unsure why the file wasn’t being properly recognized.