Hi,
I am creating a static library from many source files, I am getting "Argument list too long error" before generating a static library.
I am using android-ndk-r8c, I saw some posts related to the similar error but they provide some work around for building shared library not for static library.
Can any one give suggestions please.
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/pU_ApG-f2KwJ.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
NOTE: We do not recommend enabling this feature by default, since it makes the build slower.
I would instead recommend adding an "all.cpp" file which contains the following:
#include "file1.cpp"
#include "file2.cpp"
#include "file3.cpp"
...
Your Android.mk file would then do this:
LOCAL_SRC_FILES := all.cpp
As a bonus, it's actually quite a bit faster to compile all.cpp than all the separate files (due to not reparsing the same headers). However, be aware you may get new compile errors. A common one is variable/function naming conflicts between previously separate source files, for example:
file1.cpp:
static void func() {}
file2.cpp:
static void func() {}
Another common error is conditional includes such as:
file1.cpp:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
file2.cpp:
#include <windows.h>
CallWin32Function( ); // may not exist anymore due to WIN32_LEAN_AND_MEAN from file1.cpp
file1.cpp:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
file1.cpp:
#ifdef WIN32_LEAN_AND_MEAN#include <windows.h>
#endif
Or,
file1.cpp:
#if defined(WIN32_LEAN_AND_MEAN)#include <windows.h>
#endif
---------------------------------------------------------------
On another and more important note, it's a simple run-of-the-mill cpp file using "standard" precompiled libraries as shown here (e.g., <iostream>, not <iostream.h>). Don't use "#include <*.cpp>, that's bad practice -- that's precisely what makefiles are for.
Another common error is conditional includes such as:
Where're the conditional preprocessor macros?
// from foo1.c#define WIN32_LEAN_AND_MEAN#include <windows.h>// from foo2.c#include <windows.h>...CallWin32Function( )...
Shouldn't that be more like:file1.cpp:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>file1.cpp:
#ifdef WIN32_LEAN_AND_MEAN#include <windows.h>
#endif
Or,
file1.cpp:
#if defined(WIN32_LEAN_AND_MEAN)#include <windows.h>
#endif
---------------------------------------------------------------
On another and more important note, it's a simple run-of-the-mill cpp file using "standard" precompiled libraries as shown here (e.g., <iostream>, not <iostream.h>). Don't use "#include <*.cpp>, that's bad practice -- that's precisely what makefiles are for.
On Friday, January 11, 2013 12:09:09 PM UTC-8, kumar wrote:Hi,
I am creating a static library from many source files, I am getting "Argument list too long error" before generating a static library.
I am using android-ndk-r8c, I saw some posts related to the similar error but they provide some work around for building shared library not for static library.
Can any one give suggestions please.
Thanks in advance.