User forums > Using Code::Blocks

Howto - Cross Compiling in Linux using MingW32

<< < (13/25) > >>

keke:
Thanks for the tutorial. Have to say it's one of the most useful ones on the internet (even more useful than the stupid mingw faq).
But what you left out is what you doing before step2? What's the binary of the gui configurator you using? You said you use ubuntu, I didn't find it.
Anyway I don't need it because I wrote my makefile manually.
It's the first time when I even try to use mingw and I use it for crosscompiling a C app for windows on linux. After couple of hours trying it compiled all the c codes to obj and linked them but the final binary is a junk and broken.
I'm sure there is some prob with the flags I using. Please POST YOUR MAKEFILES, ALL OF YOU!
I need other good examples.

<pre>
OBJECTS = $(C_SRC:%.c=%.o)


# How to make a C file

%.o: %.c
        $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $<

##
## TARGET DEFINITIONS
##

.PHONY: all clean

all: $(TARGET)

install:


##
## BUILD
##

$(TARGET): $(OBJECTS)
        $(CC) $(OBJECTS) $(LIB_PATHS) $(LIBS) -o $(TARGET)
</pre>

Also since I never heard of this gui configurator thingy you using I just copied the libs like kernel32.lib out from my SDK install in windows to my appdir (maybe I shouldnt?)

defcronyke:

--- Quote from: visualphoenix on June 16, 2006, 01:52:25 am ---Step 14:

When I reached this step, compiled and tried to run my application I realized that for some reason codeblocks was trying to execute my .exe through /usr/bin/wine-auto (which I do not have)... So I created a simlink to wine:

--- Code: ---# sudo ln -s /usr/bin/wine /usr/bin/wine-auto

--- End code ---

--- End quote ---

Hi, I have code::blocks set up on debian to compile for win32 using MinGW just fine after following the tutorial in this thread, I have the debugger running just fine, however, I would really like to know where I can change the IDE settings to automatically run the resulting .exe file with wine when I select "Build and Run" (F9). I already had the /usr/bin/wine-auto file, but just to be sure, i removed it and symlinked /usr/bin/wine to /usr/bin/wine-auto, and it is not running the .exe with either of them. This is my build log:

Checking for existence: /home/bakeonandham/src/wxhelloworld2/bin/WinRelease/wxhelloworld2.exe
Executing: /home/bakeonandham/src/wxhelloworld2/bin/WinRelease/wxhelloworld2.exe  (in /home/bakeonandham/src/wxhelloworld2/.)
Process terminated with status 1 (0 minutes, 5 seconds)

I have looked through all the settings menus and I can't figure out what to change to make the .exe execute with wine. I have searched google and the code::blocks wiki, as well as these forums, and cannot find an answer, as apparently, it is just supposed to work. I started with a fresh install of the IDE and followed this tutorial exactly, and everything else works fine.

**EDIT**
Sorry for wasting everyone's time, I found the solution to my question right after I posted this. In case anyone else is wondering, here's how I made my .exe open with wine when I press (F9):

1. Open project
2. Select Project menu -> Build options
3. Click WinRelease (or whatever the win32 build target is called)
4. Select Pre/post build steps tab
5. In Post-build steps enter: /usr/bin/wine ${TARGET_OUTPUT_FILE}
6. Check the "Always execute, even if target is up-to-date" box
7. Click Ok

Jenna:

--- Quote from: defcronyke on August 03, 2009, 06:19:16 am ---**EDIT**
Sorry for wasting everyone's time, I found the solution to my question right after I posted this. In case anyone else is wondering, here's how I made my .exe open with wine when I press (F9):

1. Open project
2. Select Project menu -> Build options
3. Click WinRelease (or whatever the win32 build target is called)
4. Select Pre/post build steps tab
5. In Post-build steps enter: /usr/bin/wine ${TARGET_OUTPUT_FILE}
6. Check the "Always execute, even if target is up-to-date" box
7. Click Ok

--- End quote ---

In this case it will always run (after every build) and not only if you press F9.
Your OS (linux) has to know what it shall do with windows-executables.
You may find this wiki-article of interest :http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux#Normal_run

Nevertheless this does not always work.
You can also use the tool menu to run the windows-exe:
I use the following settings:

* Name: wine starten
* Executable: /usr/bin/wine
* Parameters: ${TARGET_OUTPUT_FILE}
* Working directory: ${PROJECT_DIR}
With the keybinder-plugin, you can set a shortcut to the new menu-entry in the tools menus and you are done.

defcronyke:
Thanks for the tip. I figured out the way to create an "open with wine" tool also, but I wanted to have the same functionality/behavior for Win32 target as for a Linux target. Surprisingly, I already had the binfmt-support package installed and my code::blocks was not opening with wine or wine-auto. I'm using Debian Squeeze by the way. Maybe a bug? Or maybe I need to set up the binfmt-support package in some special way. It's not really important to me though, as the post-build action is sufficient for my needs.

Now if I could just figure out how to build win32 files from a Linux amd64 machine... I don't expect an answer for that here though. :P

wilbefast:
Is the first page still up-to-date? 2006 seems a bit far back, and no "insight" to be found (the link doesn't work)  :?

Just thought I'd ask before breaking something.


William

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version