Results 1 to 7 of 7

Thread: Linking Error when Creating DLL with Visual Studio

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: Linking Error when Creating DLL with Visual Studio

    Thank you for your help. That all makes since to me. However, the following code should be acceptable right?
    Qt Code:
    1. int test()
    2. {
    3. int argc = 1;
    4. char *arg[] = {"test"};
    5. QApplication app(argc, argv);
    6. QPushButton quit("Quit");
    7. quit.resize(75, 30);
    8. quit.setFont(QFont("Times", 18, QFont::Bold));
    9. QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));
    10. quit.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    I tried Qt Creator and this code did compile. However, when I run the project with Visual Studio (converting with qmake -t vclib), I receive the same linking errors. Another interesting discover is that if I point Qt Creator to the Qt files it came with, a .dll is produced. If I point it to the Qt files I compiled I only get a .lib file. Why is that? In any case I really need to be able to compile with Visual Studio. I have also discovered that a the above function will compile with Visual Studio if I make the function static. Naturally this also will not do. Any more ideas?

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking Error when Creating DLL with Visual Studio

    I think u r doing it wrong..QApplication and QCoreApplication are only used in executables..when u r creating a dll or lib, u dont use them..I'd suggest u make two projects in Visual studio..one u set as a startup project which will produce an exe, in there, u create a QApplication..in other project u create a dll and u use it with the exe

  3. #3
    Join Date
    Feb 2009
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linking Error when Creating DLL with Visual Studio

    Actually, really what I would like to do is create a dll from C++ containing the GUI and have a Java backend load the GUI via JNI. It would be great to keep all the Qt stuff in C++.

  4. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking Error when Creating DLL with Visual Studio

    then why r u tyring all that.. u should go ahead and create a container and put all the gui in it..export it..if u wanna see how its all going..u'll hv to create an exe and use QApplication..when u hv all u want..remove the main function part..create a dll out of all that and use JNI..i dont think it'll be a big issue

Similar Threads

  1. Qt 4.4.1 Compile Error with MS Visual C++ 2008 Express SP1
    By BrainB0ne in forum Installation and Deployment
    Replies: 3
    Last Post: 19th August 2008, 15:49
  2. qtgui4.dll error in visual c++ 2005
    By Comptrol in forum Installation and Deployment
    Replies: 33
    Last Post: 19th June 2008, 07:18
  3. Qt configure with msvc.net
    By jivanr in forum Installation and Deployment
    Replies: 1
    Last Post: 11th June 2007, 08:17
  4. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  5. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.