I can not compile a c file that uses citro3d

Post Reply
miterosan
Posts: 2
Joined: Wed Mar 28, 2018 6:58 pm

I can not compile a c file that uses citro3d

Post by miterosan » Wed Mar 28, 2018 7:04 pm

I can not compile a c file that uses citro3d

Code: Select all

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: Select all

LIBS	:= -lctru -lm -lcitro3d
line

main.c

Code: Select all

#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)

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: I can not compile a c file that uses citro3d

Post by WinterMute » Fri Mar 30, 2018 2:07 am

miterosan wrote: Makefile contains the

Code: Select all

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

Code: Select all

LIBS	:= -lcitro3d -lctru -lm
Help keep devkitPro toolchains free, Donate today

Personal Blog

miterosan
Posts: 2
Joined: Wed Mar 28, 2018 6:58 pm

Re: I can not compile a c file that uses citro3d

Post by miterosan » Fri Mar 30, 2018 6:51 pm

Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests