Giter VIP home page Giter VIP logo

Comments (6)

raisjn avatar raisjn commented on July 19, 2024 1

it's more than just include guards, it has to do with .cpy and how it generates code.

currently, .cpy only generates .cpp code (and no header files). we've worked on adding a way for cpy to generate .h and .cpp files, but it's not finished yet.

i recommend using QT for a better build experience: it has emulator, build guards, etc.

from rmkit.

danshick avatar danshick commented on July 19, 2024

Maybe just need some include guards?

from rmkit.

mrichards42 avatar mrichards42 commented on July 19, 2024

I might give Qt a shot, although what I'm doing isn't too complicated, and I appreciate how straightforward rmkit for what I'm doing (mostly just drawing on a canvas plus a couple buttons). At this point adding a separate make step to combine all my source files into one is producing pretty reasonable compile times 🤷

from rmkit.

raisjn avatar raisjn commented on July 19, 2024

the biggest annoyance with okp for me is inability to generate .h and .cpp files. for even relatively simple cpp (namespaces, templates, nested classes), its hard to auto generate a header file. there is makeheaders from fossil, but it doesn't support namespace/template keywords. the best thing i've seen so far is doxygen's extractor, but it generates XML data.

the reason i want to split .h and .cpp is because i'd like compile times to significantly go down, and i'd like people to be able to include rmkit.h multiple times from multiple files.

in c++20, there is the module standard, which i think would fix my issue with generating .h and .cpp files. but in general, i don't like using new language features unless necessary.

the other route i've thought about is a new language with a formal grammar and parser, s.t. generating the header and implementation files will be possible. without an easier grammar, okp has to support arbitrary c++ which is tough to parse properly.

writing a new grammar / syntax is not something i'm really interested in, though, so i feel that waiting out the c++ module support (and adding it into okp) is reasonable

from rmkit.

raisjn avatar raisjn commented on July 19, 2024

i've been revisiting this. in august last year, we experimented with a "@hidden" (or "@impl") flag in okp which can be used to separate a function into its header and cpp file. Last week, I picked up development on that branch of okp and pushed it along some more. There are 3 major cases where the "@hidden" keyword was initially necessary:

  • in front of headers only applicable to a .cpp file (@hidden #include "foo.h")
  • on non inline/non static methods at the namespace scope
  • on static variable initialization

of these, only the static variable definition is a real problem for rmkit. we can use inline and static to decorate functions (as mentioned in original post by mrichards42). the major additional feature added to okp was the ability to spot lines like static int foo = 1 and separate it into two pieces: one for the .h and one for the impl.

i've pushed an example of using rmkit.h in this new way to https://github.com/rmkit-dev/rmkit-cpp-example. notice that rmkit.h gets compiled to a .o file (with its impl) and then linked against the other .o files.

from rmkit.

raisjn avatar raisjn commented on July 19, 2024

closing out, since i think this is fixed

from rmkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.