Mingw debug build fails
GoogleCodeExporter opened this issue · comments
What steps will reproduce the problem?
1. I'm trying to integrate SimpleOpt with my non-console
(subsystem:windows) Windows application. Trying to compile a debug enabled
test app with mingw compiler under windows fails.
What is the expected output? What do you see instead?
I expect the compilation to finish with success. But the compilation fails
with an error message such as "crtdbg.h: No such file or directory"
What version of the product are you using? On what operating system?
I'm using SimpleOpt rev20 from svn on Windows XP.
Please provide any additional information below.
from SimpleOpt.h Line 319 and later:
#ifdef _DEBUG
# ifdef _WIN32
# include <crtdbg.h> // !!! Mingw does not have this include file !!!
# define SO_ASSERT(b) _ASSERTE(b)
# else
# include <assert.h>
# define SO_ASSERT(b) assert(b)
# endif
#else
# define SO_ASSERT(b) //!< assertion used to test input data
#endif
Original issue reported on code.google.com by ozge...@gmail.com
on 22 May 2008 at 6:26
Please include the compiler error messages.
Original comment by brofi...@gmail.com
on 22 May 2008 at 7:28
The compiler error messages are:
SimpleOpt.h|321|crtdbg.h: No such file or directory|
SimpleGlob.h||In member function `SOCHAR* CSimpleGlobTempl<SOCHAR>::File(int)':|
SimpleGlob.h|513|error: there are no arguments to `_ASSERTE' that depend on a
template parameter, so a declaration of `_ASSERTE' must be available|
SimpleGlob.h|513|error: (if you use `-fpermissive', G++ will accept your code,
but
allowing the use of an undeclared name is deprecated)|
SimpleOpt.h||In member function `bool CSimpleOptTempl<SOCHAR>::Next() [with
SOCHAR =
wchar_t]':|
52|instantiated from here|
SimpleOpt.h|621|error: `_ASSERTE' was not declared in this scope|
52|instantiated from here|
SimpleOpt.h|621|warning: unused variable '_ASSERTE'|
SimpleGlob.h||In member function `SOCHAR* CSimpleGlobTempl<SOCHAR>::File(int)
[with
SOCHAR = wchar_t]':|
81|instantiated from here|
SimpleGlob.h|513|error: `_ASSERTE' was not declared in this scope|
81|instantiated from here|
SimpleGlob.h|513|warning: unused variable '_ASSERTE'|
SimpleOpt.h||In member function `int
CSimpleOptTempl<SOCHAR>::LookupOption(const
SOCHAR*) const [with SOCHAR = wchar_t]':|
SimpleOpt.h|649|instantiated from `bool CSimpleOptTempl<SOCHAR>::Next() [with
SOCHAR
= wchar_t]'|
52|instantiated from here|
SimpleOpt.h|888|error: `_ASSERTE' was not declared in this scope|
SimpleOpt.h|649|instantiated from `bool CSimpleOptTempl<SOCHAR>::Next() [with
SOCHAR
= wchar_t]'|
52|instantiated from here|
SimpleOpt.h|888|warning: unused variable '_ASSERTE'|
SimpleGlob.h||In member function `void
CSimpleGlobTempl<SOCHAR>::SetArgvArrayType
(CSimpleGlobTempl<SOCHAR>::ARG_ARRAY_TYPE) [with SOCHAR = wchar_t]':|
SimpleGlob.h|675|instantiated from `int CSimpleGlobTempl<SOCHAR>::Add(const
SOCHAR*)
[with SOCHAR = wchar_t]'|
SimpleGlob.h|694|instantiated from `int CSimpleGlobTempl<SOCHAR>::Add(int,
const
SOCHAR* const*) [with SOCHAR = wchar_t]'|
73|instantiated from here|
SimpleGlob.h|771|error: `_ASSERTE' was not declared in this scope|
SimpleGlob.h|771|warning: unused variable '_ASSERTE'|
SimpleGlob.h|778|error: `_ASSERTE' was not declared in this scope|
Original comment by ozge...@gmail.com
on 22 May 2008 at 8:16
Try the latest checked in version to see if it fixes the problem.
http://simpleopt.googlecode.com/svn-history/r21/trunk/SimpleOpt.h
Original comment by brofi...@gmail.com
on 22 May 2008 at 9:53
Now SimpleGlob.h seems to be problematic.
from SimpleGlob.h Line 191 and later:
// use assertions to test the input data
#ifdef _DEBUG
# ifdef _WIN32
# include <crtdbg.h>
# define SG_ASSERT(b) _ASSERTE(b)
# else
# include <assert.h>
# define SG_ASSERT(b) assert(b)
# endif
#else
# define SG_ASSERT(b)
#endif
Original comment by ozge...@gmail.com
on 22 May 2008 at 10:15
With the last fixes mingw debug build completes successfully. Thanks for your
quick
responses.
Original comment by ozge...@gmail.com
on 22 May 2008 at 10:25
Original comment by brofi...@gmail.com
on 22 May 2008 at 10:57
- Changed state: Verified
Same change in glob
http://simpleopt.googlecode.com/svn-history/r22/trunk/SimpleGlob.h
Original comment by brofi...@gmail.com
on 22 May 2008 at 10:19
concerning mingw32 cross compile under ubuntu 10.4:
i m sorry but the problem seems to be not totally fixed .
do You have ideas ?
kind regards david
===========
/usr/bin/i586-mingw32msvc-c++ -DNARYCHAR -DWCSPFORMATONLY -DINT_COST
-DDOUBLE_PROB -DWIN32 -D_WINDOWS -DWINDOWS -D_WIN32 -D_CONSOLE -Wall -static
-static-libgcc -O3 -DNDEBUG -I toulbar2/lib/win32/gmp/include -o
CMakeFiles/toulbar2.exe.dir/src/tb2main.cpp.o -c tb2main.cpp
In file included from tb2main.cpp:21:
SimpleGlob.h:330: error: 'DWORD' has not been declared
SimpleGlob.h:341: error: 'HANDLE' does not name a type
SimpleGlob.h:342: error: 'WIN32_FIND_DATAA' does not name a type
SimpleGlob.h:343: error: 'WIN32_FIND_DATAW' does not name a type
SimpleGlob.h: In constructor 'SimpleGlobBase<SOCHAR>::SimpleGlobBase()':
SimpleGlob.h:274: error: class 'SimpleGlobBase<SOCHAR>' does not have any field
named 'm_hFind'
SimpleGlob.h:274: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
SimpleGlob.h: In member function 'int
SimpleGlobBase<SOCHAR>::FindFirstFileS(const char*, unsigned int)':
SimpleGlob.h:277: error: 'm_hFind' was not declared in this scope
SimpleGlob.h:277: error: 'm_oFindDataA' was not declared in this scope
SimpleGlob.h:277: error: there are no arguments to 'FindFirstFileA' that depend
on a template parameter, so a declaration of 'FindFirstFileA' must be available
SimpleGlob.h:277: note: (if you use '-fpermissive', G++ will accept your code,
but allowing the use of an undeclared name is deprecated)
SimpleGlob.h:278: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
SimpleGlob.h:281: error: 'DWORD' was not declared in this scope
SimpleGlob.h:281: error: expected ';' before 'dwErr'
SimpleGlob.h:282: error: 'dwErr' was not declared in this scope
SimpleGlob.h:282: error: 'ERROR_FILE_NOT_FOUND' was not declared in this scope
SimpleGlob.h: In member function 'int
SimpleGlobBase<SOCHAR>::FindFirstFileS(const wchar_t*, unsigned int)':
SimpleGlob.h:288: error: 'm_hFind' was not declared in this scope
SimpleGlob.h:288: error: 'm_oFindDataW' was not declared in this scope
SimpleGlob.h:288: error: there are no arguments to 'FindFirstFileW' that depend
on a template parameter, so a declaration of 'FindFirstFileW' must be available
SimpleGlob.h:289: error: 'INVALID_HANDLE_VALUE' was not declared in this scope
SimpleGlob.h:292: error: 'DWORD' was not declared in this scope
SimpleGlob.h:292: error: expected ';' before 'dwErr'
SimpleGlob.h:293: error: 'dwErr' was not declared in this scope
SimpleGlob.h:293: error: 'ERROR_FILE_NOT_FOUND' was not declared in this scope
SimpleGlob.h: In member function 'bool
SimpleGlobBase<SOCHAR>::FindNextFileS(char)':
SimpleGlob.h:300: error: 'm_hFind' was not declared in this scope
SimpleGlob.h:300: error: 'm_oFindDataA' was not declared in this scope
SimpleGlob.h:300: error: there are no arguments to 'FindNextFileA' that depend
on a template parameter, so a declaration of 'FindNextFileA' must be available
SimpleGlob.h:300: error: 'FALSE' was not declared in this scope
SimpleGlob.h: In member function 'bool
SimpleGlobBase<SOCHAR>::FindNextFileS(wchar_t)':
SimpleGlob.h:303: error: 'm_hFind' was not declared in this scope
SimpleGlob.h:303: error: 'm_oFindDataW' was not declared in this scope
SimpleGlob.h:303: error: there are no arguments to 'FindNextFileW' that depend
on a template parameter, so a declaration of 'FindNextFileW' must be available
SimpleGlob.h:303: error: 'FALSE' was not declared in this scope
SimpleGlob.h: In member function 'void SimpleGlobBase<SOCHAR>::FindDone()':
SimpleGlob.h:307: error: 'm_hFind' was not declared in this scope
SimpleGlob.h:307: error: there are no arguments to 'FindClose' that depend on a
template parameter, so a declaration of 'FindClose' must be available
SimpleGlob.h: In member function 'const char*
SimpleGlobBase<SOCHAR>::GetFileNameS(char) const':
SimpleGlob.h:311: error: 'm_oFindDataA' was not declared in this scope
SimpleGlob.h: In member function 'const wchar_t*
SimpleGlobBase<SOCHAR>::GetFileNameS(wchar_t) const':
SimpleGlob.h:314: error: 'm_oFindDataW' was not declared in this scope
SimpleGlob.h: In member function 'bool SimpleGlobBase<SOCHAR>::IsDirS(char)
const':
SimpleGlob.h:318: error: 'm_oFindDataA' was not declared in this scope
SimpleGlob.h: In member function 'bool SimpleGlobBase<SOCHAR>::IsDirS(wchar_t)
const':
SimpleGlob.h:321: error: 'm_oFindDataW' was not declared in this scope
SimpleGlob.h: In member function 'SG_FileType
SimpleGlobBase<SOCHAR>::GetFileTypeS(const char*)':
SimpleGlob.h:325: error: there are no arguments to 'GetFileAttributesA' that
depend on a template parameter, so a declaration of 'GetFileAttributesA' must
be available
SimpleGlob.h: In member function 'SG_FileType
SimpleGlobBase<SOCHAR>::GetFileTypeS(const wchar_t*)':
SimpleGlob.h:328: error: there are no arguments to 'GetFileAttributesW' that
depend on a template parameter, so a declaration of 'GetFileAttributesW' must
be available
SimpleGlob.h: In member function 'SG_FileType
SimpleGlobBase<SOCHAR>::GetFileTypeS(int) const':
SimpleGlob.h:331: error: 'DWORD' was not declared in this scope
SimpleGlob.h:334: error: 'FILE_ATTRIBUTE_DIRECTORY' was not declared in this
scope
SimpleGlob.h: In member function 'SG_FileType
SimpleGlobBase<SOCHAR>::GetFileTypeS(const char*) [with SOCHAR = char]':
SimpleGlob.h:631: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(const
SOCHAR*) [with SOCHAR = char]'
SimpleGlob.h:697: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(int,
const SOCHAR* const*) [with SOCHAR = char]'
tb2main.cpp:318: instantiated from here
SimpleGlob.h:325: error: 'GetFileAttributesA' was not declared in this scope
SimpleGlob.h: In member function 'int
SimpleGlobBase<SOCHAR>::FindFirstFileS(const char*, unsigned int) [with SOCHAR
= char]':
SimpleGlob.h:654: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(const
SOCHAR*) [with SOCHAR = char]'
SimpleGlob.h:697: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(int,
const SOCHAR* const*) [with SOCHAR = char]'
tb2main.cpp:318: instantiated from here
SimpleGlob.h:277: error: 'FindFirstFileA' was not declared in this scope
SimpleGlob.h: In member function 'bool
SimpleGlobBase<SOCHAR>::FindNextFileS(char) [with SOCHAR = char]':
SimpleGlob.h:668: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(const
SOCHAR*) [with SOCHAR = char]'
SimpleGlob.h:697: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(int,
const SOCHAR* const*) [with SOCHAR = char]'
tb2main.cpp:318: instantiated from here
SimpleGlob.h:300: error: 'FindNextFileA' was not declared in this scope
SimpleGlob.h: In member function 'void SimpleGlobBase<SOCHAR>::FindDone() [with
SOCHAR = char]':
SimpleGlob.h:671: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(const
SOCHAR*) [with SOCHAR = char]'
SimpleGlob.h:697: instantiated from 'int CSimpleGlobTempl<SOCHAR>::Add(int,
const SOCHAR* const*) [with SOCHAR = char]'
tb2main.cpp:318: instantiated from here
SimpleGlob.h:307: error: 'FindClose' was not declared in this scope
make[2]: *** [CMakeFiles/toulbar2.exe.dir/src/tb2main.cpp.o] Error 1
make[2]: Leaving directory `toulbar2/bwin'
make[1]: *** [CMakeFiles/toulbar2.exe.dir/all] Error 2
make[1]: Leaving directory `toulbar2/bwin'
make: *** [all] Error 2
Original comment by david.al...@gmail.com
on 1 Sep 2010 at 11:17
[deleted comment]
It may surprise you, but Ubuntu Linux is not Windows. Remove the following
defines:
-DWIN32 -D_WINDOWS -DWINDOWS -D_WIN32
Original comment by brofi...@gmail.com
on 2 Sep 2010 at 1:03
yes it may surprise, but in cross compilation , win32 is specified under
Linux.
because : i don t known a other way to declare the wanted arch.
for instance in our software the target plateform allows with #ifdef to
specified
the right syscall. or remove and add code specific.
Original comment by david.al...@gmail.com
on 2 Sep 2010 at 5:23
All of the errors are because standard Win32 types are not being found. Since
not even DWORD and HANDLE are defined, it appears that you are not including
windows.h.
Original comment by brofi...@gmail.com
on 2 Sep 2010 at 5:15