CjMt2 28 Posted November 6, 2024 Share Posted November 6, 2024 (edited) My problem is: $ /usr/local/bin/gmake compiling ani.cpp ani.cpp: In function 'DWORD ani_attack_speed(LPCHARACTER)': ani.cpp:353:32: error: invalid use of incomplete type 'class CItem' 353 | if (ITEM_WEAPON != item->GetType()) | ^~ In file included from stdafx.h:56, from ani.cpp:3: typedef.h:35:7: note: forward declaration of 'class CItem' 35 | class CItem; | ^~~~~ ani.cpp:357:26: error: invalid use of incomplete type 'class CItem' 357 | int weapon = item->GetSubType(); | ^~ typedef.h:35:7: note: forward declaration of 'class CItem' 35 | class CItem; | ^~~~~ ani.cpp: In function 'DWORD ani_combo_speed(LPCHARACTER, BYTE)': ani.cpp:372:57: error: invalid use of incomplete type 'class CItem' 372 | return s_ANI.attack_speed(ch->GetRaceNum(), item->GetSubType(), combo, ch->IsRiding()); | ^~ typedef.h:35:7: note: forward declaration of 'class CItem' 35 | class CItem; | ^~~~~ and in ani.cpp is DWORD ani_attack_speed(LPCHARACTER ch) { DWORD speed = 1000; if (NULL == ch) return speed; LPITEM item = ch->GetWear(WEAR_WEAPON); if (NULL == item) return speed; if (ITEM_WEAPON != item->GetType()) return speed; int race = ch->GetRaceNum(); int weapon = item->GetSubType(); if (weapon == WEAPON_TWO_HANDED) weapon = WEAPON_SWORD; return s_ANI.attack_speed(race, weapon); } I use gcc12 $ gmake -version GNU Make 4.4.1 Built for amd64-portbld-freebsd14.1 Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. I have to say that on the i386, the virtual machine that came with the source, I think martysama57, these ffiles compile beautifully, they don't even display any errors or warnings. Moreover, on amd64 without compat_x and libs32 installed I only receive linking ../game_r41029 /usr/local/bin/ld: skipping incompatible /usr/lib/libmd.so when searching for -lmd /usr/local/bin/ld: skipping incompatible /usr/lib/libmd.a when searching for -lmd /usr/local/bin/ld: cannot find -lmd: No such file or directory /usr/local/bin/ld: skipping incompatible /usr/lib/libmd.so when searching for -lmd /usr/local/bin/ld: skipping incompatible /lib/libc++.so.1 when searching for /lib/libc++.so.1 /usr/local/bin/ld: cannot find /lib/libc++.so.1: file in wrong format /usr/local/bin/ld: skipping incompatible /lib/libc++.so.1 when searching for /lib/libc++.so.1 /usr/local/bin/ld: skipping incompatible /usr/lib/libcxxrt.so when searching for /usr/lib/libcxxrt.so /usr/local/bin/ld: cannot find /usr/lib/libcxxrt.so: file in wrong format /usr/local/bin/ld: skipping incompatible /usr/lib/libcxxrt.so when searching for /usr/lib/libcxxrt.so collect2: error: ld returned 1 exit status gmake: *** [Makefile:181: ../game_r41029] Error 1 Edited November 6, 2024 by CjMt2 For almost any problem related to FreeBSD, simply send a PM! Link to comment https://metin2.dev/topic/33193-error-invalid-use-of-incomplete-type-class-citem/ Share on other sites More sharing options...
TheEqualizer 109 Posted November 7, 2024 Share Posted November 7, 2024 You haven't stated what your problem is. The error you are getting is because your code is trying to dereference a pointer to an incomplete type. To fix this you have to provide the definition of the type (by, for example, including the header where the type is defined) before you can dereference it. Here's an example that causes the error you got: #include <iostream> struct foo; //forward declare type 'foo' void PrintFoo(foo* f) { std::cout << f->bar; //Error: dereferencing an incomplete type } struct foo { int bar{0}; }; void PrintFoo2(foo* f) { std::cout << foo->bar; //OK: compiler has seen the definition of 'foo' } Link to comment https://metin2.dev/topic/33193-error-invalid-use-of-incomplete-type-class-citem/#findComment-167994 Share on other sites More sharing options...
Recommended Posts
Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now