OS : windows 10 64 bit
IDE : codeblocks 17.12
Compiler : gcc 7.3
with
wxWidget 3.1.2
i build wxWidget 3.1.2 according to the official guide without changing any defaults
make -f makefile.gcc (make v4.2)
i am using codeblocks wxwidget start script 3.1.X
i have choosen correct option according to the wxWidget build
(Monolithic unicode and debug)
The codeblock generated sample problem is not linking properly
( gives build fail with 0 error 0 warning )
-------------- Clean: Debug in sac (compiler: GNU GCC Compiler)---------------
Cleaned "sac - Debug"
-------------- Build: Debug in sac (compiler: GNU GCC Compiler)---------------
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswu -c C:\Users\MC\Desktop\wxw\sac\wx_pch.h -o wx_pch.h.gch\Debug_wx_pch_h_gch
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswu -c C:\Users\MC\Desktop\wxw\sac\GUIFrame.cpp -o obj\Debug\GUIFrame.o
windres.exe -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswu -J rc -O coff -i C:\Users\MC\Desktop\wxw\sac\resource.rc -o obj\Debug\resource.res
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswu -c C:\Users\MC\Desktop\wxw\sac\sacApp.cpp -o obj\Debug\sacApp.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswu -c C:\Users\MC\Desktop\wxw\sac\sacMain.cpp -o obj\Debug\sacMain.o
g++.exe -LC:\wxWidgets-3.1.2\lib\gcc_dll -o bin\Debug\sac.exe obj\Debug\GUIFrame.o obj\Debug\sacApp.o obj\Debug\sacMain.o obj\Debug\resource.res -mthreads -lwxmsw31u -mwindows
Process terminated with status 1 (0 minute(s), 11 second(s))
Process terminated with status 1 (0 minute(s), 11 second(s))
Process terminated with status 1 (0 minute(s), 12 second(s))
0 error(s), 0 warning(s) (0 minute(s), 12 second(s))
any help ?
This post assumes you have compiled wxWidgets 3.1.3 and are successful in compiling the executable samples via make and makefile.gcc that is included and are using gcc.
It also assumes you have already applied your environment vars in windows, applied your compiler flags wx-config --cxxflags and linker flag wx-config --libs.
It seems everyone else has dugout the makefile library order and has fixed it inside of codeblocks. I wanted to build small all in one apps so I decided on a MONOLITHIC with SHARED=0 UNICODE build.
It seems the easiest fix is thus.
CodeBlocks arranges the linker library order in a different order than the makefile does and jams up the linker, in my case varying from "theme" something or other to scrollbar issues.
So the quickest work around I've found is to delete all the entries in the codeblocks build options lists and enter only into the "Other Linker Options" for Debug and Release and this does work.
So from the console listing the makefile shows copy those linker settings in the order that makefile settings list. So until someone makes a header fixup entry for something higher than 2.8.8 there is this cumbersome workaround.
In my case the working order is as follows:
-mwindows
-lwxmsw31ud
-lwxmsw31ud_gl
-lwxscintillad
-lwxtiffd
-lwxjpegd
-lwxpngd
-lwxzlibd
-lwxregexud
-lwxexpatd
-lkernel32
-luser32
-lgdi32
-lcomdlg32
-lwinspool
-lwinmm
-lshell32
-lshlwapi
-lcomctl32
-lole32
-loleaut32
-luuid
-lrpcrt4
-ladvapi32
-lversion
-lwsock32
-lwininet
-loleacc
-luxtheme
In Release it is the same less the "d" which designates the debug file i.e.:
-lwxmsw31u_gl instead of -lwxmsw31ud_gl,
-lwxtiff in place of -lwxtiffd etc...
Related
i am a newbie here and i need help in compiling my wxwidgets project to work with codeblocks.
i downloaded wxwidgets windows intaller 'wxMSW-3.1.0-Setup.exe' from http://www.wxwidgets.org/downloads/
i run the program to install, then i read about making environmental variable at system properties>>advanced system settings>>environment variables. thus i made it by setting variable name as "path" and variable value as "C:\Program Files (x86)\CodeBlocks\MinGW\bin".
also read about making builds for wxwidget in cmd prompt, so launch cmd and input such procedures below (some which took a long time).
mingw32-make -v
cd C:\wxWidgets-3.1.0\build\msw
mingw32-make -f makefile.gcc clean
mingw32-make -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1 UNICODE=1
mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1
after all that i went on to make a wxwidgets project.
i got two errors when making wxwidgets project "a matching debug configuration cannot be found in the wxwidgets directory you specified" and "a matching release configuration cannot be found in the wxwidgets directory you specified"
but then i skip and went on to project, after build and run i got these errors below.
Build log for debug:
-------------- Build: Debug in testwx (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -LC:\wxWidgets-3.1.0\lib\gcc_lib -o bin\Debug\testwx.exe obj\Debug\testwxApp.o obj\Debug\testwxMain.o obj\Debug\resource.res -mthreads -lwxmsw30u -lwxpng -lwxjpeg -lwxtiff -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw30u
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 5 second(s))
2 error(s), 0 warning(s) (0 minute(s), 5 second(s))
Build log for release:
-------------- Build: Release in testwx (compiler: GNU GCC Compiler)---------------
windres.exe -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -J rc -O coff -i C:\Users\AJIKAH~1\DOCUME~1\Programs\WXWIDG~1\testwx\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=c++11 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c "C:\Users\A JIKAH\Documents\Programs\wxWidgets\testwx\testwxApp.cpp" -o obj\Release\testwxApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=c++11 -IC:\wxWidgets-3.1.0\include -IC:\wxWidgets-3.1.0\lib\gcc_lib\mswu -c "C:\Users\A JIKAH\Documents\Programs\wxWidgets\testwx\testwxMain.cpp" -o obj\Release\testwxMain.o
mingw32-g++.exe -LC:\wxWidgets-3.1.0\lib\gcc_lib -o bin\Release\testwx.exe obj\Release\testwxApp.o obj\Release\testwxMain.o obj\Release\resource.res -s -mthreads -lwxmsw30u -lwxpng -lwxjpeg -lwxtiff -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: cannot find -lwxmsw30u
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 33 second(s))
2 error(s), 0 warning(s) (0 minute(s), 33 second(s))
now i update code::blocks 16.01 to code::blocks 17.01.
can someone pls help me solve this problem?
You said you downloaded "wxMSW-3.1.0-Setup.exe". But this part "...cannot find -lwxmsw30u..." means you're trying to link with libraries from wxWidgets 3.0.
To make sure your project is trying to link with the correct version of wxWidgets, on the second page of the codeblocks wizard (the one that says "Please select the wxWidgets version you want to use"), be sure to select the "wxWidgets 3.1.x" option.
Another common cause of the "matching configuration cannot be found" problem is not selecting the right options on the 8th page of the wizard (the one that says "Please select various configuration options"). Since you said you build the library with the options " SHARED=0 MONOLITHIC=1 UNICODE=1", be sure to check "wxWidgets is built as a monolithic library" and "Enable unicode" and be sure "Use wxWidgets DLL" is unchecked.
#MrSudden,
Is there any reason why you built the library as MONOLITHIC?
This configuration, also supported, is not recommended and can cause problems in the long run.
It is also does not have a big testing from the core wx team, and so have a big chances of breakage.
There is no gain of building "monolithic" library vs. "multilib" one.
Thank you.
I installed precompiled WxWidget libraries and tried to run the default program in CodeBlocks but it gives the following error:
mingw32-g++.exe: error: bin\Release\new2.exe: No such file or directory
Paths for WxWidget Libraries and MinGW are already specified.
My question is; How to make CodeBlocks generate a .exe file for WxWidgets project?
I have already tried all solutions listed in this question: "No such file or directory" error in CodeBlocks
Complete Build Log:
-------------- Build: Release in new2 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -Wno-unused-
local-typedefs -Wall -O2 -ID:\WxWidgets\wxWidgets2.8\include -I\msw -c
C:\Users\ShifaShah\Documents\new2\new2App.cpp -o obj\Release\new2App.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -Wno-unused-
local-typedefs -Wall -O2 -ID:\WxWidgets\wxWidgets2.8\include -I\msw -c
C:\Users\ShifaShah\Documents\new2\new2Main.cpp -o obj\Release\new2Main.o
windres.exe -ID:\WxWidgets\wxWidgets2.8\include -I\msw -J rc -O coff -i
C:\Users\SHIFAS~1\DOCUME~1\new2\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -L -o bin\Release\new2.exe obj\Release\new2App.o
obj\Release\new2Main.o obj\Release\resource.res -s -mthreads -lwxmsw_core -lwxbase -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -
ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
mingw32-g++.exe: error: bin\Release\new2.exe: No such file or directory
Process terminated with status 1 (0 minute(s), 3 second(s))
1 error(s), 0 warning(s) (0 minute(s), 3 second(s))
-L -o bin\Release\new2.exe
Here's the problem. The -L flag requires an argument, but the usual argument (a directory to search for libraries) is not provided. So the next flag, -o, is interpreted as an argument to -L, and bin\Release\new2.exe is interpreted as a name of an input file, which of course doesn't exist yet.
Check your compiler flags and make sure there's no stray -L anywhere, and no "additional libraries directory" is specified as a white space string or similar.
hi i want to use cocos2dx android studio in windows.
i downloaded android-ndk-r12, android studio and apache-ant-1.9.7. cocos2dx 3.11.1
now i am successfully create a project by using command cocos.py new MyGame -p com.MyCompany.MyGame -l cpp -d I:\Work\cocos2dx.
But where i am using cocos.py compile -p android --android-studio to compile i am getting this error
[armeabi] "Compile++ thumb": "MyGame_shared <= AppDelegate.cpp"
process_begin: CreateProcess(NULL, I:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/ma
in.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -O0 -UNDEBUG -Ijni/../../../Classes -II:/Software/ProgramingSoftware/cocos2dx/android
-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -II:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -II:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../sources/c
xx-stl/gnu-libstdc++/4.9/include/backward -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/editor-support/cocostudio/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/editor-support/cocosbuilder/.. -II:/Work/cocos2dx/MyGame/proj.an
droid-studio/../cocos2d/cocos/3d/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/editor-support/spine/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/network -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/audi
o/android/../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/ui/../editor-support -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/audio/android/../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/fl
atbuffers/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/GUI/CCControlExtension -II:/Work/cocos2
dx/MyGame/proj.android-studio/../cocos2d/extensions/GUI/CCScrollView -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/coc
os/./.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/tinyxml2 -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/unzip -II:/Wo
rk/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/chipmunk/include/chipmunk -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/xxhash -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/nslo
g -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/poly2tri -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/poly2tri/common -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/pol
y2tri/sweep -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/clipper -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/websockets/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/..
/cocos2d/external/Box2D/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/bullet/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/freetype2/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-stud
io/../cocos2d/external/freetype2/prebuilt/android/../../include/android/freetype2 -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/png/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/jpeg
/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/tiff/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/webp/prebuilt/android/../../include/android -
II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/chipmunk/prebuilt/android/../../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/zlib/prebuilt/android/../../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos
2d/external/recast/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/platform/android -II:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../sources/android/cpufeatures -Ijni -DANDROID -DUSE_FILE32API -Wa,--noexecstack -Wformat -Wer
ror=format-security -Wno-deprecated-declarations -Wno-extern-c-compat -D__STDC_LIMIT_MACROS=1 -Wno-extern-c-compat -fexceptions -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCOCOS2D_DEBUG=1 -isystem I:/Software/ProgramingSoftware/cocos2dx
/android-ndk-r12/build//../platforms/android-19/arch-arm/usr/include -c jni/hellocpp/main.cpp -o ./obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/main.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: * [obj/local/armeabi/objs-debug/MyGame_shared/hellocpp/main.o] Error 2
make: * Waiting for unfinished jobs....
process_begin: CreateProcess(NULL, I:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs-debug/MyGame_shared////Cl
asses/AppDelegate.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -O0 -UNDEBUG -Ijni/../../../Classes -II:/Software/ProgramingSoftware/c
ocos2dx/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -II:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -II:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/buil
d//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/editor-support/cocostudio/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/editor-support/cocosbuilder/.. -II:/Work/cocos2dx
/MyGame/proj.android-studio/../cocos2d/cocos/3d/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/editor-support/spine/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/network -II:/Work/cocos2dx/MyGame/proj.android-studio/../coc
os2d/cocos/audio/android/../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/ui/../editor-support -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/audio/android/../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../coco
s2d/external/flatbuffers/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/GUI/CCControlExtension -
II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/extensions/GUI/CCScrollView -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./. -II:/Work/cocos2dx/MyGame/proj.android-studio
/../cocos2d/cocos/./.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/tinyxml2 -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../externa
l/unzip -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/chipmunk/include/chipmunk -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/xxhash -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./.
./external/nslog -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/poly2tri -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/poly2tri/common -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./
../external/poly2tri/sweep -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/./../external/clipper -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/websockets/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.an
droid-studio/../cocos2d/external/Box2D/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/bullet/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/freetype2/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/pr
oj.android-studio/../cocos2d/external/freetype2/prebuilt/android/../../include/android/freetype2 -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/png/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2
d/external/jpeg/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/tiff/prebuilt/android/../../include/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/webp/prebuilt/android/../../in
clude/android -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/chipmunk/prebuilt/android/../../include -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/external/zlib/prebuilt/android/../../include -II:/Work/cocos2dx/MyGame/proj.android-
studio/../cocos2d/external/recast/.. -II:/Work/cocos2dx/MyGame/proj.android-studio/../cocos2d/cocos/platform/android -II:/Software/ProgramingSoftware/cocos2dx/android-ndk-r12/build//../sources/android/cpufeatures -Ijni -DANDROID -DUSE_FILE32API -Wa,--noexecstac
k -Wformat -Werror=format-security -Wno-deprecated-declarations -Wno-extern-c-compat -D__STDC_LIMIT_MACROS=1 -Wno-extern-c-compat -fexceptions -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCOCOS2D_DEBUG=1 -isystem I:/Software/ProgramingSo
ftware/cocos2dx/android-ndk-r12/build//../platforms/android-19/arch-arm/usr/include -c jni/../../../Classes/AppDelegate.cpp -o ./obj/local/armeabi/objs-debug/MyGame_shared////Classes/AppDelegate.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/local/armeabi/objs-debug/MyGame_shared///__/Classes/AppDelegate.o] Error 2
make: Leaving directory `I:/Work/cocos2dx/MyGame/proj.android-studio/app'
Error running command, return code: 2.
That command made everything works for me :
cocos compile -p android --android-studio --app-abi armeabi
But it only gonna compile it for the abi armeabi architecture.
I have a Qt project that I'm compiling with GCC and MinGW for Ubuntu and Windows.
I got a requirement to harden it by adding the following LDFLAGS:
Stack execution protection: LDFLAGS="-z noexecstack"
Data relocation and protection (RELRO): LDLFAGS="-z relro -z now"
The question is can this be done with .pro file and how? I found it easy to add LFLAGS and CFLAGS in the project file but couldn't find anything for LDFLAGS. Even the output Makefiles don't seem to have any LDFLAGS defined.
One way I found after long googling was to add QMAKE_CFLAGS_RELEASE += "--noexecstack" in the .pro file but I'm not convinced this is the right way.
After the line above, the generated Makefile looks like this:
CC = gcc
CXX = g++
DEFINES = -DUNICODE -DMY_LIBRARY -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB
CFLAGS = -pipe -fno-keep-inline-dllexport -O2 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security --noexecstack -Wall -Wextra $(DEFINES)
CXXFLAGS = -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads $(DEFINES)
LINKER = g++
LFLAGS = -Wl,-s -shared -Wl,-subsystem,windows -mthreads -Wl,--out-implib,C:\libmylib0.a
noexecstack appears in the CLFAGS list but not sure if that's alright. CFLAGS is not the same as LDFLAGS. It doesn't seems to validate the command either since --thisdoesntexist seemed to go through as well when I tried.
Thank you in advance.
EDIT:
Based on Gwen's answer I tried adding QMAKE_LFLAGS += "-z noexecstack -z relro -z now" but this produced an error from ld.exe:
error: unrecognized option '-z'
EDIT2:
Tool versions:
C:\Qt\Qt5.5.0\Tools\mingw492_32\bin>ld.exe -v
GNU ld (GNU Binutils) 2.24
C:\Qt\Qt5.5.0\Tools\mingw492_32\bin>g++.exe --version
g++.exe (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 4.9.2
With my configuration (QtCreator + Visual C++ compiler), the LFLAGS defined in the makefile is given to the linker, contrary to what is stated in the GNU make documentation:
LDFLAGS
: Extra flags to give to compilers when they are supposed to invoke the linker[...]
LFLAGS
: Extra flags to give to Lex.
I think you should try adding QMAKE_LFLAGS += "-z noexecstack -z relro -z now" to your .pro file, empty your build folder, re-run qmake, and see if the option is given to the linker.
I'm having quite a bit of trouble linking a test project of FLTK I'm doing on Code::Blocks, Windows 7.
After spending quite a lot of time understanding how to put the libraries in the correct order, I managed to get the project nearly done. However there's still a linking problem:
mingw32-g++.exe -Wall -fexceptions -IC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0 -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c C:\Users\Svalorzen\Documents\Projects\test\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\test.exe obj\Debug\main.o -LC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib -mwindows -lfltk -lole32 -luuid -lcomctl32
C:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib/libfltk.a(Fl_Native_File_Chooser.o):Fl_Native_File_Chooser.cxx:(.text+0x1556): undefined reference to `__chkstk_ms'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 0 warnings
However, using the same exact script that Code::Blocks shows, executed on command prompt ( or even msys for what matters ), correctly compiles and links everything. The resulting exe also works.
C:\Users\Svalorzen\Documents\Projects\test>mingw32-g++ -Wall -fexceptions -IC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0 -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c C:\Users\Svalorzen\Documents\Projects\test\main.cpp -o obj\Debug\main.o
C:\Users\Svalorzen\Documents\Projects\test>mingw32-g++ -o bin\Debug\test.exe obj\Debug\main.o -LC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib -mwindows -lfltk -lole32 -luuid -lcomctl32
C:\Users\Svalorzen\Documents\Projects\test>dir bin\Debug\test.exe
Volume in drive C has no label.
Volume Serial Number is 00E8-6659
Directory of C:\Users\Svalorzen\Documents\Projects\test\bin\Debug
10/05/2012 19:01 661.087 test.exe
1 File(s) 661.087 bytes
0 Dir(s) 66.016.849.920 bytes free
The paths in the instruction are all absolute, so I don't really understand why this is.
What am I doing wrong? What I should check?
EDIT: It turned out that I had a MinGW installation I didn't remember about and Code::Blocks was using that one. I changed it and now everything is fixed.
If your MinGW is up-to-date, then try adding -no-vcproj and -no-dsp and then run mingw32-make confclean.
It turned out that I had a MinGW installation I didn't remember about and Code::Blocks was using that one.
I setup Code::Blocks with the same compiler that created the library and now everything is fine.