A Few problems with qt



  • Hi, i got a few problems and cant fix them

    1. If i want to start debugger i get linker error - release works...
    2. How can i create a .dll ? I find no option
    3. How can i change projekt properties like from unicode to multibyte? In Vs i just had to rightclick projekt and projekt properties ôo

  • Moderators

    Woud be nice to have those questions in separate threads:

    Post the error code and message, provide more info if possible.

    Yes. If you are using qmake, then you need to add TEMPLATE = lib to your .pro file (and change the source code to have a lib to build, with all the exports etc.). You can also begin a new library project from within Qt Creator, if you are using that IDE.

    Yes, there are several places where this can be done. Check out text editor settings in Qt Creator preferences, or change the filest in your text editor, Qt will respect that. Unicode is multibyte, by the way.

    Hard to add anything without more concrete questions/ data.



  • Hi! Welcome to DevNet :)

    1. Information not enough for answering to your first question. Give us error output.
    2. In Qt Creator NewProject ->Other Project -> C++ Library
      -3. Unfortunately i don't know answer to this question.-
    3. Tools->Options...-> Text Editor -> Behavior -> File Encodings


  • hey

    @ 3 - i need this option http://s14.directupload.net/images/130326/jsouccb5.png from Unicode to Multibyte, otherwise my projekt dont work, there is actually no multibyte option in text editor settings -.-

    @ 2 yes that works fine ^-^

    @ 1 :-1: Fehler:LNK1123: Fehler bei der Konvertierung in COFF: Datei ist ungültig oder beschädigt.


  • Moderators

    Just some notes on 3:

    sierdzio - in MS terms Multibyte (MBCS) means actually 2-byte without particular encoding specified (so wchar_t or short, depending on yet another setting), so unicode(or at least not all variants) is not multibyte. Yeah, I know this is a bit silly but there is a lot of history behind this naming convention so it sticked ;)

    qxoz - this setting is for source file encoding, the setting in VS is actually for conditional compilation of unicode or MBCS support.

    There is no direct equivalent in Qt Creator for this setting as this is partly MS specific option, but you can still set it in the .pro file manually, by adding defines (via DEFINES +=):
    UNICODE and _UNICODE is equivalent to "Unicode" setting in VS
    MBCS and _MBCS is equivalent to "Multibyte" setting VS
    no additional defines - equivalent to "None" in VS

    One note though is that from what I remember creator adds definition of UNICODE by default (in mkspec I think) to the compiler parameter list (and also qmake?), so you might want to remove it via QMAKE_CXXFLAGS -= DUNICODE or something like that if you don't want unicode support.


  • Moderators

    [quote author="Krzysztof Kawa" date="1364303275"]sierdzio - in MS terms Multibyte (MBCS) means actually 2-byte without particular encoding specified (so wchar_t or short, depending on yet another setting), so unicode(or at least not all variants) is not multibyte. Yeah, I know this is a bit silly but there is a lot of history behind this naming convention so it sticked ;)[/quote]

    Didn't know about this one, thanks. Well, no surprise, I'm not using Windows much, and I don't MSVS at all ;)



  • Krzysztof Kawa@ thanks for information.



  • hej, i just added
    DEFINES += _MBCS
    QMAKE_CXXFLAGS -= DUNICODE

    to .pro but still get the error

    C:\Users\Aleksander\Desktop\c++\LoL_Helper\mainwindow.cpp:21: Fehler:C2664: 'FindWindowW': Konvertierung des Parameters 2 von 'LPCSTR' in 'LPCWSTR' nicht m”glich
    Die Typen, auf die verwiesen wird, sind nicht verknpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.

    which is the same in VS with Unicode but when i change to multibyte no problem...


  • Moderators

    Sorry, I just guessed where the UNICODE is defined, and actually it's in DEFINES, not QMAKE_CXXFLAGS, so it should be
    @
    DEFINES -= UNICODE
    DEFINES += _MBCS
    @

    Btw. Unless it's some kind of large, legacy app you are porting, I would strongly suggest to stick to unicode. For sure in new apps. It's really THE standard these days. Or, at least, use the "neutral" types like LPCTSTR instead of LPCSTR and LPCWSTR to allow it to compile both ways.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.