Enrico Forestieri a écrit :
On Wed, May 10, 2006 at 09:43:01AM +0200, Abdelrazak Younes wrote:
Bo Peng a écrit :
Abdel said that scons is able to recognize .C files as C++ source
files on a native Windows environment. Why it is not able to do so
with cygwin?
I did not read that email in detail, what I know is that gcc tells the
content of a .c file and make itself g++ if the file is indeed in C++.
However, at linking time, gcc and g++ may lead to different results
(stdc++.so etc).
A renaming of lyx .C files will never happen so we will have to use
the current solution, .i.e., force moc'ing, and force the use of g++
(I know, this leads to non-portability..... but this is life).
Please only reserve this treatment for cygwin as it seems to work well
with mingw:
* gcc rightfully takes .C file as C++ (by contents or by extension, I am
not sure).
* Scons generates moc_xxx.cc file so they should be correctly identified
as C++ by gcc.
* linking should be done with g++ or IIRC you can also use gcc and pass
"-lstdc++"
Wait a moment Abdel. If scons is using gcc to compile .C files it means
that it is not able to recognize them as C++ sources.
I confirm that Scons is using gcc and g++ to compile the .C file. I
reckon gcc is intelligent enough to recognize these file as C++.
Otherwise they would obviously not compile at all.
The weird thing is that I see this in SConstruct:
# under windows, scons is confused by .C/.c and uses gcc instead of
# g++. I am forcing the use of g++ here. This is expected to change
# after lyx renames all .C files to .cpp
if platform_name in ['win32', 'cygwin']:
env['CC'] = 'g++'
env['LINK'] = 'g++'
But gcc is used everywhere! I have removed 'win32' from the code above
and it works the same. I think these environment variable are simply
ignored in straight win32 (remember that I am compiling from the console
not from the cygwin shell). A related problem that I have is that
CCFLAGS and CXXFLAGS are ignored even if Scons tell me they are acknoledge.
This also means
that it will not check for mocable files. So, how can it work for you?
I don't know but it works. mocable files are correctly recognized and
the resulting moc_xxx.cc files are compiled with gcc.
I verified that 57 object files were missing from libqt3.a without
Bo's "treatment" and this led to the dreadful "undefined reference for
vtable in..." error.
I don't have that with qt4 /mingw :-)
Abdel.