Your library will be named "libcrypt" so you have to have -lcrypt instead of -llib.
Your library will be named "libcrypt" so you have to have -lcrypt instead of -llib.
I dont know I just replied but the post got lost. If you see doubt post please forgive.
Oh! I have corrected myself...Thank you wysota.
There is still another problem.
I have defined myLib.h and myLib.cpp in lib directory. I have defined a method called getString() which return HELLO WORLD.
When I call this method in main.cpp defined in app directory I get unreferneced parameter "test::getString()".
Then I made the function inline in myLib.h...It worked. Why is that happening????
Also I want myApp to depend on myLib ie. when I say
qmake scribble.pro
make clean
make
First myLib should compile and create "crypt" then myApp should create "scribble.exe".
Now I have to do seperately.
ie. I have to do for myLib
Creates cryptQt Code:
qmake myLib.pro make clean makeTo copy to clipboard, switch view to plain text mode
Then I have to say
Created scribble.exeQt Code:
qmake scribble.pro make clean makeTo copy to clipboard, switch view to plain text mode
This is not a good idea
Thanks for your understanding
You're using Windows, right? I think you need to export each symbol in the library and import it in your application.
Ask google for dllexport and dllimport. Also take a look at qmake docs (or Qt sources) as it's also telling how to do that. I think you can also search the forum for dllimport - that may give you the quickest result.
I'm not good at this, I never managed to do it properly, but I know it's possible.Also I want myApp to depend on myLib ie. when I say
qmake scribble.pro
make clean
make
First myLib should compile and create "crypt" then myApp should create "scribble.exe".
You'll probably need DEPENDPATH variable and TARGET.depends should be set on the library (the command to build it, like "cd ../app; make"), but I can't tell you more. Maybe others had more luck with it.
A quick workaround is to operate on the top level project file and add the "ordered" keyword to the CONFIG variable. This will then build all targets (subdirs) and build them according to the order specified in the SUBDIRS variable.Now I have to do seperately.
ie. I have to do for myLib
Creates cryptQt Code:
qmake myLib.pro make clean makeTo copy to clipboard, switch view to plain text mode
Then I have to say
Created scribble.exeQt Code:
qmake scribble.pro make clean makeTo copy to clipboard, switch view to plain text mode
This is not a good idea
text Code:
CONFIG+=ordered SUBDIRS=lib appTo copy to clipboard, switch view to plain text mode
No, I changed
toQt Code:
unix:LIBS += -lcrypt -L/root/Desktop/rajeev/samplePro/libTo copy to clipboard, switch view to plain text mode
Qt Code:
unix:LIBS += -L/root/Desktop/rajeev/samplePro/lib -lcryptTo copy to clipboard, switch view to plain text mode
It doesnt work.
Please check the updated zipped file
First a side note - are you sure this is a good idea to use the root account for your daily tasks (especially for running the desktop)?
Now for the problems:
1. getString() implementation is not part of the test class, you forgot the "test::" part.
2. Change those absolute paths to ../lib.
3. Change libs to: LIBS += ../lib/libcrypt.a
You're using your superuser account to do non-maintanance tasks. This is considered a stability (and sometimes also security) risk. To be honest the desktop shouldn't even start for the root user. And you certainly shouldn't use the root account when programming - this is very error prone and very risky - you can render your system unusable (you might delete files crucial for your system by accident or lock the operating system and not be able to unlock it as the root account doesn't have some limitations regular accounts have).Qt Code:
/root/Desktop/rajeev/samplePro/libTo copy to clipboard, switch view to plain text mode
vermarajeev (20th February 2007)
Bookmarks