devkitPro.org
https://devkitpro.org/

I can not compile a c file that uses citro3d
https://devkitpro.org/viewtopic.php?f=39&t=8703
Page 1 of 1

Author:  miterosan [ Wed Mar 28, 2018 7:04 pm ]
Post subject:  I can not compile a c file that uses citro3d

I can not compile a c file that uses citro3d

Code:
linking myown3dsgame.elf
C:/devkitPro/libctru/lib\libcitro3d.a(base.o): In function `C3D_Init':
/home/fincs/releases/ctrulib/citro3d/source/base.c:99: undefined reference to `gxCmdQueueRun'
/home/fincs/releases/ctrulib/citro3d/source/base.c:94: undefined reference to `gpuCmdBufSize'
/home/fincs/releases/ctrulib/citro3d/source/base.c:94: undefined reference to `gpuCmdBuf'
/home/fincs/releases/ctrulib/citro3d/source/base.c:94: undefined reference to `gpuCmdBufOffset'
C:/devkitPro/libctru/lib\libcitro3d.a(base.o): In function `C3D_Fini':
/home/fincs/releases/ctrulib/citro3d/source/base.c:356: undefined reference to `gxCmdQueueStop'
/home/fincs/releases/ctrulib/citro3d/source/base.c:357: undefined reference to `gxCmdQueueWait'
C:/devkitPro/libctru/lib\libcitro3d.a(renderqueue.o): In function `C3Di_WaitAndClearQueue':
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:131: undefined reference to `gxCmdQueueWait'
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:137: undefined reference to `gxCmdQueueStop'
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:138: undefined reference to `gxCmdQueueClear'
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:137: undefined reference to `gxCmdQueueStop'
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:138: undefined reference to `gxCmdQueueClear'
C:/devkitPro/libctru/lib\libcitro3d.a(renderqueue.o): In function `onQueueFinish':
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:98: undefined reference to `gxCmdQueueStop'
/home/fincs/releases/ctrulib/citro3d/source/renderqueue.c:99: undefined reference to `gxCmdQueueClear'
C:/devkitPro/libctru/lib\libcitro3d.a(effect.o): In function `C3D_DepthMap':
/home/fincs/releases/ctrulib/citro3d/source/effect.c:14: undefined reference to `f32tof24'
/home/fincs/releases/ctrulib/citro3d/source/effect.c:15: undefined reference to `f32tof24'
C:/devkitPro/libctru/lib\libcitro3d.a(effect.o): In function `C3D_FragOpShadow':
/home/fincs/releases/ctrulib/citro3d/source/effect.c:87: undefined reference to `f32tof16'
/home/fincs/releases/ctrulib/citro3d/source/effect.c:87: undefined reference to `f32tof16'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitARM/3ds_rules:40: /c/myown3dsgame/myown3dsgame.elf] Error 1
make: *** [Makefile:136: build] Error 2


Makefile contains the
Code:
LIBS   := -lctru -lm -lcitro3d
line

main.c
Code:
#include <3ds.h>
#include <stdio.h>
#include <citro3d.h>

int main(int argc, char **argv)
{

gfxInitDefault();
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, 0xFF0505, 0);
u32 transferFlags = GX_TRANSFER_FLIP_VERT(false)|
GX_TRANSFER_OUT_TILED(false)|
GX_TRANSFER_RAW_COPY(false)|
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8)|
GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGBA8)|
GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_XY);
C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, transferFlags);
while (aptMainLoop())
{

hidScanInput();
u32 kDown = hidKeysDown();
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}

C3D_Fini();
gfxExit();
return 0;
}


I have a full devkitpro installation.
I am on the newest version (2.2.1)

Author:  WinterMute [ Fri Mar 30, 2018 2:07 am ]
Post subject:  Re: I can not compile a c file that uses citro3d

miterosan wrote:
Makefile contains the
Code:
LIBS   := -lctru -lm -lcitro3d
line


link order matters. citro3d uses functions from libctru so -lcitro3d must come before -lctru
Code:
LIBS   := -lcitro3d -lctru -lm

Author:  miterosan [ Fri Mar 30, 2018 6:51 pm ]
Post subject:  Re: I can not compile a c file that uses citro3d

Thank you!

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/