0

I am trying to create a C++ library with QT. However, when I launch the builder, QT Creator asks me to provide an executable. I do not understand what it is really asking for. Why would need an executable to make a library?

Thanks!!!

4
  • Perhaps it is asking you for the location of "qmake"? Have you set the QTDIR and QMAKESPEC environment variables? Commented Sep 27, 2009 at 9:07
  • What is the executable it is asking for ? Platform details etc. will be useful as well. Commented Sep 27, 2009 at 9:15
  • The only way qtcreator ask me an executable is when I run my librairy project not when I build it. Can you tell us more about the executable it is asking for? Commented Sep 27, 2009 at 9:41
  • 3
    @Giuseppe: you should post an answer describing what you did to fix this. Commented Sep 29, 2009 at 15:19

2 Answers 2

1

To make a static library NAME, just collect your objects into an archive with

$ ar ru libNAME.a *.o

To make a shared library, it's

$ g++ OPTIONS -shared -o libNAME.so -Wl,-soname,NAME *.o

When you are linking a shared library with g++, you also need to give it any link OPTIONS that you would need for your program if you were linking an executable. For example, extra libraries (-lm), optimisation (-O2), pthreads (-pthread) or whatever.

Sign up to request clarification or add additional context in comments.

Comments

1

I guess it is trying to launch an executable (which is normal if you are developing an application).

Instead of hitting "Run" or Ctrl+R, try to use "Build" or Ctrl+B. This should prevent Qt Creator from trying to launch your project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.