LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-02-2010, 06:09 PM   #1
Eupator
LQ Newbie
 
Registered: May 2008
Distribution: Slackware/Slackintosh
Posts: 28

Rep: Reputation: 0
Attempting to Cross-compile SDL_image with mingw on a linux host


Hi all,

I've written a few applications with SDL, and recently I've taken interest in porting them to win32 via mingw, hosted on my Slackware laptop.

I downloaded and installed mingw to my home directory, and I also downloaded the mingw32 SDL development pacakge ("SDL-devel-1.2.14-mingw32.tar.gz") from the SDL website. After installing it with proper prefixes, I can compile SDL programs with mingw and run them on a Windows box.

However, I'm having less luck with programs that use both SDL and SDL_image. There's no mingw32 development package on the SDL_image site as there is on the SDL site, so I'm a bit confused on how to proceed.

Should I download the source package and compile it with mingw? If so, how? The typical ./configure, make, make install uses gcc, not i686-pc-mingw-gcc, and attempting to specify it causes the configure script to complain that the compiler doesn't create valid binaries.

I've tried compiling with gcc and setting the prefixes to my mingw installation; I'm getting no luck with that, and I suspect it's the wrong road to take.

I would greatly appreciate any hints.

Thanks,
Eupator
 
Old 02-02-2010, 07:21 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,241

Rep: Reputation: 194Reputation: 194
Download the visual C SDL image dev-kit.
 
Old 02-03-2010, 08:12 AM   #3
Eupator
LQ Newbie
 
Registered: May 2008
Distribution: Slackware/Slackintosh
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smeezekitty View Post
Download the visual C SDL image dev-kit.
Could you elaborate? I downloaded SDL_image-devel-1.2.10-VC.zip from http://www.libsdl.org/projects/SDL_image/ . I tried compiling it with gcc and installing to my mingw directory, but cross compiling still fails:

Code:
$ /home/me/mingw32/usr/bin/i686-pc-mingw32-gcc -o SDL_test.exe main.c `/home/me/mingw32/bin/sdl-config --cflags --libs` -lSDL_image
/tmp/cc8ukDpN.o:main.c:(.text+0x1a): undefined reference to `_IMG_Load'
collect2: ld returned 1 exit status
main.c contains only:

Code:
#include<stdio.h>
#include"SDL/SDL.h"
#include"SDL/SDL_image.h"

int main(int argc,char *argv[])
{
        SDL_Surface *s;
        printf("Hello, world!\n");
        s=IMG_Load("test.png");
        return;
}
Any ideas?
 
Old 02-03-2010, 01:57 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,241

Rep: Reputation: 194Reputation: 194
http://jcatki.no-ip.org:8080/SDL_ima...age.html#SEC13
 
Old 02-03-2010, 04:47 PM   #5
Eupator
LQ Newbie
 
Registered: May 2008
Distribution: Slackware/Slackintosh
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smeezekitty View Post
This returns the same error during linkage, with the name of one function replaced with another.

Code:
/tmp/ccMdPNbq.o:main.c:(.text+0x3a): undefined reference to `_IMG_LoadTyped_RW'
collect2: ld returned 1 exit status
Any other ideas?
 
Old 02-03-2010, 05:33 PM   #6
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,241

Rep: Reputation: 194Reputation: 194
Add the flag -lSDLimage (or was it -lSDLImage) to the compiler / linker command line.
 
Old 02-03-2010, 06:03 PM   #7
Eupator
LQ Newbie
 
Registered: May 2008
Distribution: Slackware/Slackintosh
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smeezekitty View Post
Add the flag -lSDLimage (or was it -lSDLImage) to the compiler / linker command line.
I've been linking with -lSDL_image. Neither of the above libraries exist.
 
  


Reply

Tags
mingw, sdl, sdlimage


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross Compile Tools on Linux for FreeBSD rabh Linux - Software 1 03-04-2009 10:37 PM
Question about building a Linux hosted, Mingw-targeted cross compiler tomdkat Linux - Software 2 12-12-2008 11:55 AM
how to cross compile sourcecode for arm-linux tamilm Linux - Networking 0 09-10-2008 10:53 AM
minGW: cross platform using g77? shengchieh Programming 4 01-03-2005 01:13 PM
Cross compile Win32->Linux grunw Linux - Software 0 02-24-2004 10:11 AM


All times are GMT -5. The time now is 08:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration