Maybe there are mixed code from Visual C++ to g++?$ make
C++ backends/platform/sdl/sdl.o
C++ backends/platform/sdl/win32/win32-main.o
backends/platform/sdl/win32/win32-main.cpp: In function ‘int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)’:
backends/platform/sdl/win32/win32-main.cpp:44:14: error: ‘__argc’ was not declared in this scope
return main(__argc, __argv);
^
backends/platform/sdl/win32/win32-main.cpp:44:22: error: ‘__argv’ was not declared in this scope
return main(__argc, __argv);
^
backends/platform/sdl/win32/win32-main.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Makefile.common:103: recipe for target 'backends/platform/sdl/win32/win32-main.o' failed
make: *** [backends/platform/sdl/win32/win32-main.o] Error 1
Compiling under mingw
Moderator: ScummVM Team
Compiling under mingw
When I try to compile scummvm under mingw I've got this error message:
Re: Compiling under mingw
That might be an issue with your MinGW setup. We use MinGW and MinGW64 on our buildbot to build ScummVM and it works fine there.samsaga2 wrote:When I try to compile scummvm under mingw I've got this error message:
Maybe there are mixed code from Visual C++ to g++?$ make
C++ backends/platform/sdl/sdl.o
C++ backends/platform/sdl/win32/win32-main.o
backends/platform/sdl/win32/win32-main.cpp: In function ‘int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)’:
backends/platform/sdl/win32/win32-main.cpp:44:14: error: ‘__argc’ was not declared in this scope
return main(__argc, __argv);
^
backends/platform/sdl/win32/win32-main.cpp:44:22: error: ‘__argv’ was not declared in this scope
return main(__argc, __argv);
^
backends/platform/sdl/win32/win32-main.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Makefile.common:103: recipe for target 'backends/platform/sdl/win32/win32-main.o' failed
make: *** [backends/platform/sdl/win32/win32-main.o] Error 1
It would be helpful to know some more details like: What version of MinGW are you using? Where did you get it from? Did you use any special CXXFLAGS when configuring ScummVM? etc.
__argc and __argv are global variables provided in stdlib.h. See: https://stackoverflow.com/questions/179 ... v-in-mingw
I wonder if we should parse the lpCmdLine string explicitly instead as in: http://www.cmake.org/pipermail/cmake/20 ... 05172.html ?
I wonder if we should parse the lpCmdLine string explicitly instead as in: http://www.cmake.org/pipermail/cmake/20 ... 05172.html ?
We should not be parsing the command line ourselves -- that's why argc and argv exist in the first place.digitall wrote:I wonder if we should parse the lpCmdLine string explicitly instead as in: http://www.cmake.org/pipermail/cmake/20 ... 05172.html ?
Before we jump to any sort of guess or conclusion, we need to hear back from samsaga2 how he/she set up MinGW.
SIGH. Yes, but they don't exist on WINDOWS. The MinGW compiler environment provides them as __argc and __argv... or should.
I did some checking and ludde's other project, OpenTTD actually does the parsing to create argc and argv for Windows in the codebase as well, rather than relying on MinGW to provide this:
http://hg.openttd.org/openttd/trunk.hg/ ... 2.cpp#l422
I did some checking and ludde's other project, OpenTTD actually does the parsing to create argc and argv for Windows in the codebase as well, rather than relying on MinGW to provide this:
http://hg.openttd.org/openttd/trunk.hg/ ... 2.cpp#l422
Firstly, I am not preventing samsaga2 from providing a response to Lordhoto's query. In fact, I totally agree with his inquiry i.e. "It would be helpful to know some more details like: What version of MinGW are you using? Where did you get it from? Did you use any special CXXFLAGS when configuring ScummVM? etc."
However, it has been 5 days since he posted that and samsaga2 has not responded. It would probably be useful to provide some specific instructions for him to run to get that information as MinGW for Windows doesn't have a clear "version" for the entire package and via mingw-get is auto-updating so hard to get a good answer... so I don't think he is going to respond.
However, it has been 5 days since he posted that and samsaga2 has not responded. It would probably be useful to provide some specific instructions for him to run to get that information as MinGW for Windows doesn't have a clear "version" for the entire package and via mingw-get is auto-updating so hard to get a good answer... so I don't think he is going to respond.
Secondly, I never stated that I do not believe MinGW for Windows is not providing these, but the provided error messages from the compiler say exactly that:
<snip>
C++ backends/platform/sdl/win32/win32-main.o
backends/platform/sdl/win32/win32-main.cpp: In function ‘int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)’:
backends/platform/sdl/win32/win32-main.cpp:44:14: error: ‘__argc’ was not declared in this scope
return main(__argc, __argv);
^
backends/platform/sdl/win32/win32-main.cpp:44:22: error: ‘__argv’ was not declared in this scope
return main(__argc, __argv);
</snip>
I suggested that maybe since the code was already Win32 specific and has the command line string as LPSTR, we could avoid using the MinGW provided __argc and __argv and do the command line string parsing in-tree as per OpenTTD to avoid this in future.
<snip>
C++ backends/platform/sdl/win32/win32-main.o
backends/platform/sdl/win32/win32-main.cpp: In function ‘int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)’:
backends/platform/sdl/win32/win32-main.cpp:44:14: error: ‘__argc’ was not declared in this scope
return main(__argc, __argv);
^
backends/platform/sdl/win32/win32-main.cpp:44:22: error: ‘__argv’ was not declared in this scope
return main(__argc, __argv);
</snip>
I suggested that maybe since the code was already Win32 specific and has the command line string as LPSTR, we could avoid using the MinGW provided __argc and __argv and do the command line string parsing in-tree as per OpenTTD to avoid this in future.
Thirdly, I have just updated MinGW for Windows on my WinXP 32-bit box using "mingw-get update" followed by "mingw-get upgrade" to the latest version to see if this fails.
This is from http://www.mingw.org/ originally and is using GCC 4.8.1 currently.
I have then tried a normal "./configure && make clean && make" build of ScummVM at the command line and this compiles backends/platform/sdl/win32/win32-main.o with no problems.
I threfore concur that this appears to just be broken for samsaga's setup and he should check with the MinGW configuration and compilation instructions here:
http://wiki.scummvm.org/index.php/Compi ... mmVM/MinGW
This is from http://www.mingw.org/ originally and is using GCC 4.8.1 currently.
I have then tried a normal "./configure && make clean && make" build of ScummVM at the command line and this compiles backends/platform/sdl/win32/win32-main.o with no problems.
I threfore concur that this appears to just be broken for samsaga's setup and he should check with the MinGW configuration and compilation instructions here:
http://wiki.scummvm.org/index.php/Compi ... mmVM/MinGW
Funnily enough, __argc and __argv we are using seem to also be Win32 specific. See here.digitall wrote:I suggested that maybe since the code was already Win32 specific and has the command line string as LPSTR, we could avoid using the MinGW provided __argc and __argv and do the command line string parsing in-tree as per OpenTTD to avoid this in future.
That probably also explains why Cygwin shows similar errors. But I am pretty sure we do not support Cygwin anymore anyway. So, that's really not surprising.