Page 1 of 1

How to compile windows x64 program?

Posted: Fri Nov 22, 2013 5:38 am
by xuiv
I have installed tdm32-gcc and tdm64-gcc,
I compile wxwidgets3.0 use batch file:
@echo off
set MINGW_DIR_x64=C:\Go\MinGW64-4.8.1\
set MINGW_DIR_x86=C:\Go\MinGW32-4.8.1\

echo Buiding x64 platform
set VENDOR_NAME=x64
call "%MINGW_DIR_x64%\mingwvars.bat"
mingw32-make -f makefile.gcc CFG=_x64 CPP="gcc -E -D_M_AMD64" BUILD=debug SHARED=0 RUNTIME_LIBS=static DEBUG_INFO=1 VENDOR=%VENDOR_NAME% USE_OPENGL=1
mingw32-make -f makefile.gcc CFG=_x64 CPP="gcc -E -D_M_AMD64" BUILD=release SHARED=0 RUNTIME_LIBS=static DEBUG_INFO=0 VENDOR=%VENDOR_NAME% USE_OPENGL=1
mingw32-make -f makefile.gcc CFG=_x64 CPP="gcc -E -D_M_AMD64" BUILD=debug SHARED=1 RUNTIME_LIBS=dynamic DEBUG_INFO=1 VENDOR=%VENDOR_NAME% USE_OPENGL=1
mingw32-make -f makefile.gcc CFG=_x64 CPP="gcc -E -D_M_AMD64" BUILD=release SHARED=1 RUNTIME_LIBS=dynamic DEBUG_INFO=0 VENDOR=%VENDOR_NAME% USE_OPENGL=1

echo Buiding x86 platform
set VENDOR_NAME=x86
call "%MINGW_DIR_x86%\mingwvars.bat"
mingw32-make -f makefile.gcc CFG=_x86 BUILD=debug SHARED=0 RUNTIME_LIBS=static DEBUG_INFO=1 VENDOR=%VENDOR_NAME% USE_OPENGL=1
mingw32-make -f makefile.gcc CFG=_x86 BUILD=release SHARED=0 RUNTIME_LIBS=static DEBUG_INFO=0 VENDOR=%VENDOR_NAME% USE_OPENGL=1
mingw32-make -f makefile.gcc CFG=_x86 BUILD=debug SHARED=1 RUNTIME_LIBS=dynamic DEBUG_INFO=1 VENDOR=%VENDOR_NAME% USE_OPENGL=1
mingw32-make -f makefile.gcc CFG=_x86 BUILD=release SHARED=1 RUNTIME_LIBS=dynamic DEBUG_INFO=0 VENDOR=%VENDOR_NAME% USE_OPENGL=1
I could use codelite compile x64 program , but it couldn't run, the x86 program could run.

my codelite environment is this:
CodeLiteDir=C:\Program Files (x86)\CodeLite
UNIT_TEST_PP_SRC_DIR=C:\Program Files (x86)\CodeLite\UnitTest++-1.3
PATH=.;C:\Go\wxWidgets-3.0.0\lib\gcc_dll_x86;C:\Go\MinGW32-4.8.1\bin;%PATH%
WXCFG=gcc_dll_x86\mswu
WXWIN=C:\Go\wxWidgets-3.0.0
and
CodeLiteDir=C:\Program Files (x86)\CodeLite
UNIT_TEST_PP_SRC_DIR=C:\Program Files (x86)\CodeLite\UnitTest++-1.3
PATH=.;C:\Go\wxWidgets-3.0.0\lib\gcc_dll_x64;C:\Go\MinGW64-4.8.1\bin;%PATH%
WXCFG=gcc_dll_x64\mswu
WXWIN=C:\Go\wxWidgets-3.0.0

Re: How to compile windows x64 program?

Posted: Fri Nov 22, 2013 9:44 am
by eranif
xuiv wrote:I could use codelite compile x64 program , but it couldn't run, the x86 program could run.
You will have to provide us more than this to help you

Please read the HOT TO POST thread to see what is missing
Mainly: add some build logs etc

Eran

Re: How to compile windows x64 program?

Posted: Sat Nov 23, 2013 5:02 am
by xuiv

Code: Select all

C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 4 -e -f  Makefile"
"----------Building project:[ hello - Release ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Polaris/Desktop/hello'
windres -i "C:/Users/Polaris/Desktop/hello/win_resources.rc" --use-temp-file --define __WXMSW__ --define _UNICODE --include-dir C:/Go/wxWidgets-3.0.0/lib/gcc_dll_x64/mswu --include-dir C:/Go/wxWidgets-3.0.0/include --define WXUSINGDLL    -o ./Release/win_resources.rc.o
windres: warning: 24: 1: 1033: duplicate value
g++  -c  "C:/Users/Polaris/Desktop/hello/wxcrafter.cpp" -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/Go/wxWidgets-3.0.0/lib/gcc_dll_x64/mswu -IC:/Go/wxWidgets-3.0.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0     -o ./Release/wxcrafter.o -I. -I.
g++  -c  "C:/Users/Polaris/Desktop/hello/wxcrafter_bitmaps.cpp" -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/Go/wxWidgets-3.0.0/lib/gcc_dll_x64/mswu -IC:/Go/wxWidgets-3.0.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0     -o ./Release/wxcrafter_bitmaps.o -I. -I.
g++  -c  "C:/Users/Polaris/Desktop/hello/MainFrame.cpp" -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/Go/wxWidgets-3.0.0/lib/gcc_dll_x64/mswu -IC:/Go/wxWidgets-3.0.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0     -o ./Release/MainFrame.o -I. -I.
g++  -c  "C:/Users/Polaris/Desktop/hello/main.cpp" -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/Go/wxWidgets-3.0.0/lib/gcc_dll_x64/mswu -IC:/Go/wxWidgets-3.0.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0     -o ./Release/main.o -I. -I.
g++ -o ./Release/hello @"hello.txt" -L.    -mthreads -LC:/Go/wxWidgets-3.0.0/lib/gcc_dll_x64 -lwxmsw30u_xrc -lwxmsw30u_aui -lwxmsw30u_html -lwxmsw30u_adv -lwxmsw30u_core -lwxbase30u_xml -lwxbase30u_net -lwxmsw30u_richtext -lwxbase30u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32  -mwindows
mingw32-make.exe[1]: Leaving directory 'C:/Users/Polaris/Desktop/hello'
0 errors, 0 warnings, total time: 00:00:23 seconds

Code: Select all

Debugger exited with following error string:
"During startup program exited with code 0xc000007b."

Re: How to compile windows x64 program?

Posted: Sat Nov 23, 2013 12:36 pm
by eranif
Does your toolchain points to the correct executables? (g++-64)
Check it from: Settings -> Build Settings -> Compilers

What happens if you run it without debugger, does it work?
Do you have a 64bit debugger?

Eran

Re: How to compile windows x64 program?

Posted: Sat Nov 23, 2013 2:06 pm
by xuiv
the x64 windows console program could run, but wxwidgets program couldn't , I need win64 codelite

Re: How to compile windows x64 program?

Posted: Sat Nov 23, 2013 6:55 pm
by eranif
xuiv wrote:I need win64 codelite
No you don't.
You just need to setup your toolchain properly. You also need to post more info: What is the error that you get when you try to execute your application from CMD? (or from codelite, the error you showed earlier was from the debugger...)
but wxwidgets program couldn't
And why is that? Did you try to run it from outside of codelite? what error do you get?

You need to provide more info, or no one (regardless of the IDE you choose to use) will not help you

Eran

Re: How to compile windows x64 program?

Posted: Sun Nov 24, 2013 11:55 am
by xuiv
goto include\wx\msw and backup wx.manifest , rename amd64.manifest to wx.manifest, everything is OK, thanks! :D

Re: How to compile windows x64 program?

Posted: Wed Jan 22, 2014 11:09 pm
by Fred
Hello,
Windows error 7B can come up, when your 64 bit EXE tries to load a 32 bit DLL.
This can happen, if a 32 bit DLL with the same name is in tne current path.
Or, if you use a manifest, the manifest does not define the correct processor architectur for this DLL. Must be:
processorArchitecture="amd64"

Also, there are incompatible versions of the same MinGW-DLLs around. So, Imo it is a good idea to put the correct DLLs into the EXE's directory.

Regards,
Fred