MSVC and FET compilation problems

Started by Volker Dirr, March 08, 2018, 08:57:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Volker Dirr

MSVC is pretty "bad". I used the new 2017 Community edition vs MinGW 5.3.0. That version is 2 years older.

Results on my computer with the same file and the same seed of course. Also running it 2*2 times and comparing if the results are the same. (Of course generated timetables are the same):

MSVC 2017: 1 minute 32 seconds
MinGw 5.3.0: 1 minute 26 seconds

So i suggest to stay at the gcc compiler. (But with fixing the compiler problem of MSVC)

Liviu Lalescu

#1
Volker refers to: https://lalescu.ro/liviu/fet/forum/index.php?topic=3600.msg19319

Quotes:

Quote
Liviu: MSVC compiling stopped after a few minutes:
..\tmp\gui\ui_helpaboutform_template.h:884: Fehler: C1091: Compilerlimit : Die Zeichenfolge berschreitet die L,,nge um 65535 Bytes

That mean: Compilerlimit reached because of too many characters.

I try to increase the compiler limit (i must search how to do it, i never used MSVC so far).
Do you think there will be an other variant how to fix that problem?
Maybe by using a resource file instead of adding data direcitly into that file?

Quote
Looks like it is impossible to fix that problem for MSVC by changing a limit. Looks like it is a fixed limit in Microsoft compiler.

Quote: "Characters in a character string literal or wide string literal (after concatenation) - C++ standard: 65536, Visual C++ compiler: 65535 single-byte characters, including the null terminator, and 32767 double-byte characters, including the null terminator. "

See:
https://docs.microsoft.com/en-gb/cpp/cpp/compiler-limits

I fear the only way to fix that problem is using a Qt resource file if Microsoft isn't clever enough to read so large files.

Volker and other programmers: how can I shorten this string? It must contain Unicode characters.

Volker Dirr

I suggest using a Qt resource file (maybe "resources.qrc") like this:
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>help.txt</file>
</qresource>
</RCC>


Than just save the help string in that help file.

Now read that file and print it in the source with something like this:
QString helpString;
QFile file(":/help.txt");
if(!file.open(QIODevice::ReadOnly)){
helpString+="Can't open file 'help.txt'.\n";
}
QTextStream in(&file);
//in.setCodec("ISO 8859-15");
while(!in.atEnd()){
helpString += in.readLine()+"\n";
}

Volker Dirr

I forgot:
And the .pro file (i think only the src.pro, not the src-cl.pro) need a new line like this:
RESOURCES += src/resources.qrc

Volker Dirr

hmmm... I forgot that the string must be translated. hmm...

rodolforg

What about split the text in two strings?
Move it out from .ui file to .cpp one.

Liviu Lalescu

Quote from: rodolforg on March 08, 2018, 09:33:30 PM
What about split the text in two strings?
Move it out from .ui file to .cpp one.

Then I need to add Unicode (UTF-8) characters into the .cpp file, which I don't want (like special characters "José César Fernández López - Spanish translation" or "ßingen - suggestions.")

rodolforg

If you want some trick, you can split into two text boxes. In runtime, hide one of them and merge the strings programmatically.
Or just use tabs to separate about/credits/translators.

Volker Dirr

I think it is better to write a bug report (feature request) to Qt Designer. It schould automaticaly split it.
Because:
a) Other guys might get the same problem
b) Even if we split: it is just a question of time. we will run into the same problem again.

Liviu Lalescu


Volker Dirr

Looks like he suggested the same as me. But what about translation?

Liviu Lalescu

Quote from: Volker Dirr on March 09, 2018, 05:26:46 PM
Looks like he suggested the same as me. But what about translation?

Indeed... (but his code is more Qt-friendly).

Yes, I think the translation is not done correctly.