error in compiling Tutorial code in linux x86_64

edited December 2011 in Help request
hello all and hi , I'm compiling Tutorial 1 code in my computer:
$gcc -c  "./01_Object.c" -g -D__orxDEBUG__  -o ./01_Objet.o -I. -I. -I./dev-linux/include

$ g++ -o "01_Object.o" -L. -L./dev-linux/lib  -lorxd/usr/bin/ld: skipping incompatible ./dev-linux/lib/liborxd.so when searching for -lorxd
/usr/bin/ld: cannot find -lorxd
collect2: ld returned 1 exit status

I guess maybe it's my x86_64 system reason,so I add -m32 option and complie again,but still get an error:

$gcc -c  "./01_Object.c" -g -D__orxDEBUG__  -o ./01_Objet.o -I. -I. -I./dev-linux/include

$ g++ -o "./01_Object.o" -L. -L./dev-linux/lib  -lorxd -m32
/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status


I spent hours searching but still cannot find the reason, someone can please help me? :(


by the way, I'm using
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) ,
orx-dev-linux-1.3rc0 package ,
Fedora 16 x86_64 system.







2011_12_14_001_Selection.png

Comments

  • edited December 2011
    nantish wrote:
    hello all and hi , I'm compiling Tutorial 1 code in my computer:

    Hi nantish and welcome here!
    $gcc -c  "./01_Object.c" -g -D__orxDEBUG__  -o ./01_Objet.o -I. -I. -I./dev-linux/include
    
    $ g++ -o "01_Object.o" -L. -L./dev-linux/lib  -lorxd/usr/bin/ld: skipping incompatible ./dev-linux/lib/liborxd.so when searching for -lorxd
    /usr/bin/ld: cannot find -lorxd
    collect2: ld returned 1 exit status
    

    I guess maybe it's my x86_64 system reason,so I add -m32 option and complie again,but still get an error:

    As you've noticed the package only contains 32b binaries for linux. However if you sync the SVN trunk directly, 64b linux versions have been added (in the /linux64 folders instead /linux) and don't require the -m32 flag.
    $gcc -c  "./01_Object.c" -g -D__orxDEBUG__  -o ./01_Objet.o -I. -I. -I./dev-linux/include
    
    $ g++ -o "./01_Object.o" -L. -L./dev-linux/lib  -lorxd -m32
    /usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib/crt1.o: In function `_start':
    (.text+0x18): undefined reference to `main'
    collect2: ld returned 1 exit status
    


    I spent hours searching but still cannot find the reason, someone can please help me? :(

    Sure! The issue comes from the fact you're trying to compile the tutorial 1 as a stand alone executable whereas it's meant to be a plugin (ie. a shared library loaded via orx launcher).
    The tutorials #1 - #9 are all plugins, whereas #10 - #12 are stand alone exes.

    You can use the codelite project file to build all the tutorials if you want (or at least to look at the command line parameters sent to gcc). If you use the SVN version, you'll find linux64 configurations whereas if you're using the package, you'll need to add the -m32 flag.

    You can find more info in the tutorial section of the wiki or in the README file.
    by the way, I'm using
    gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) ,
    orx-dev-linux-1.3rc0 package ,
    Fedora 16 x86_64 system.

    Again, I'd recommend using the SVN version as it not only has linux64 binaries/configurations but also because it has a lot of bug fixes and improvements (~200 commits since the latest release).
  • edited December 2011
    Very thanks for your detailed and patienced responce ,iarwain.

    Knowing what's the error for now, I'll go and checkout the SVN version immediately.

    Thanks very much again. :) :)
  • edited December 2011
    My pleasure!

    If you still have issues, please let us know. Don't hesitate to ask questions here, sometimes it can help save some hours and frustration. :)
Sign In or Register to comment.