Author Topic: Host application to "run" a library  (Read 140 times)

Offline lissalissa

  • Single posting newcomer
  • *
  • Posts: 7
Host application to "run" a library
« on: August 07, 2022, 07:30:17 pm »
Hello, friends,
I am authoring a dynamic library on Fedora 36 using codeblocks.  This is the first time I've written my own library, and what I would like to have happen is to click "build and run", have the library compiled, and then have some code execute to run some unit tests.  When I click build and run the error I get is "You must select a host application to 'run' a library...".  I can find no guidance on how to specify a host application.

Is there any way to extract the behavior for which I'm looking, or similar behavior?
Thanks!

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1054
Re: Host application to "run" a library
« Reply #1 on: August 07, 2022, 08:38:58 pm »
Libraries are not executable, you need an application using them. In your case the "Host application" should be that containing the tests.

Offline lissalissa

  • Single posting newcomer
  • *
  • Posts: 7
Re: Host application to "run" a library
« Reply #2 on: August 07, 2022, 10:36:46 pm »
So if I'm understanding correctly, I need to create a separate project that builds an executable and links to my library project?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1054
Re: Host application to "run" a library
« Reply #3 on: Yesterday at 11:15:37 am »
Not necessarily a separate project, it may be a new target in your current project.

That project (or target) will contain the "code execute to run some unit tests".