Results 1 to 5 of 5

Thread: Building Executable

  1. #1
    Join Date
    Jul 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Building Executable

    Hi All,

    I'm quite new to VC++ and QT and I thought you guys could help me out. I've downloaded some open source software that I'm trying to modify. I've installed QT and VC++ properly and it seems to be working. Now I just need to know how to build the project and create an executable file. I've built the project (Build -> Build Project), but that doesn't create the .exe file. Can someone please help me figure out how to create the executable?

    Your help is much appreciated!

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Building Executable

    Are you using Qt Creator or Visual Studio and how did you setup your project?

  3. #3
    Join Date
    Jul 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Building Executable

    I'm using VC++ Express. And I think I know how to build the executable, but I'm getting these errors:

    Qt Code:
    1. 1>.\comport.cpp(163) : error C2664: 'strlen' : cannot convert parameter 1 from 'TCHAR [255]' to 'const char *'
    2. 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    3. 1>.\comport.cpp(166) : error C2664: '_strnicmp' : cannot convert parameter 1 from 'TCHAR [255]' to 'const char *'
    4. 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    5. 1>.\comport.cpp(383) : error C2664: 'strlen' : cannot convert parameter 1 from 'LPCTSTR' to 'const char *'
    6. 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    7. 1>Generating Code...
    8. 1>Build log was saved at "file://c:\Users\Raj\Documents\ECE 4A\FYDP\TI Transceiver\GUI\release\BuildLog.htm"
    9. 1>sensMon - 3 error(s), 0 warning(s)
    10. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    To copy to clipboard, switch view to plain text mode 

    I believe I need to typecast a lot of these variables before sending them into the functions. Anyone know how to typecase TCHAR [255] to const char*?

    Thanks

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building Executable

    everything is typecasted the same way..

    char*p=(char*)tch;
    or better way
    static_cast<char*>(tch);

  5. #5
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Building Executable

    Quote Originally Posted by deville75 View Post
    I believe I need to typecast a lot of these variables before sending them into the functions. Anyone know how to typecase TCHAR [255] to const char*?
    TCHAR is a type that is defined based on whether UNICODE is defined or not. If defined, TCHAR will be wchar_t else char. The fact of the matter is that the strlen, stricmp functions work on chars. You might need to use wcslen,wcsicmp and the likes. I believe there are some functions like _tcslen as well.

    Converting between wchar_t and char is done using wcstombs and mbstowcs (mbs being multi-byte string and wcs being wide-char string).

    On the whole I'd say you should convert everything to a QString asap. QString will understand TCHAR based on the fact that it understands both wchar_t and char and saves you of this MSy TCHAR hassle.

    If you want to stick to the TCHAR thing, start reading here.

Similar Threads

  1. QAxServer:: Out of process executable server
    By Pharell in forum Qt Programming
    Replies: 3
    Last Post: 14th December 2012, 11:31
  2. Which Linux distribution is best for building compatible apps?
    By Oxidative in forum Installation and Deployment
    Replies: 8
    Last Post: 9th July 2009, 17:13
  3. Qt3 qprocess, executable exited?
    By triperzonak in forum Newbie
    Replies: 2
    Last Post: 22nd September 2008, 12:21
  4. Library and Subdirs building problem
    By herenbdy in forum Qt Programming
    Replies: 2
    Last Post: 10th July 2008, 03:10
  5. Static Executable
    By perseo in forum Qt Programming
    Replies: 1
    Last Post: 20th May 2008, 22:39

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.