Homebrew cctype error

TheMiningBoyAlpha

Well-Known Member
OP
Newcomer
Joined
Apr 24, 2018
Messages
80
Trophies
0
Age
19
XP
360
Country
United States
I am trying to use TinyXML2 with my homebrew (for loading level data), and i keep getting errors with a few includes with TinyXML2.

In file included from C:/Users/TheMiningBoy/Documents/Roblox_DS/Game/source/main.c:12: C:/Users/TheMiningBoy/Documents/Roblox_DS/Game/include/tinyxml2.h:37:13: fatal error: cctype: No such file or directory 37 | # include <cctype> | ^~~~~~~~ compilation terminated. make[1]: *** [/opt/devkitpro/devkitARM/base_rules:85: main.o] Error 1 make: *** [Makefile:170: build] Error 2 Press any key to continue . . .

Can I have some help getting this to work?​
 

Pk11

A catgirl with a DSi
Member
Joined
Jun 26, 2019
Messages
1,285
Trophies
1
Age
22
Location
米国
Website
pk11.us
XP
3,894
Country
United States
You're trying to include a C++ header from a C file. You should be able to either rename "main.c" to "main.cpp" if you're fine with changing to C++ or change "#include <cctype>" to "#include <ctype.h>". In C++ "<c[name]>" and "<[name].h>" headers are the same thing afaik, the "c[name]" style is more C++ style while "[name].h" is more C style, but in plain C you need the "[name].h" include.

Edit: Note: Changing the include may fix the problem of that include, but since it's trying to include a C++ header it's likely that that's C++ code you're trying to include which won't work if main() is in a C file, so you're probably better off changing main to a cpp file if you're trying to include other C++ code. It shouldn't require much if any code changes.
 
Last edited by Pk11,

TheMiningBoyAlpha

Well-Known Member
OP
Newcomer
Joined
Apr 24, 2018
Messages
80
Trophies
0
Age
19
XP
360
Country
United States
You're trying to include a C++ header from a C file. You should be able to either rename "main.c" to "main.cpp" if you're fine with changing to C++ or change "#include <cctype>" to "#include <ctype.h>". In C++ "<c[name]>" and "<[name].h>" headers are the same thing afaik, the "c[name]" style is more C++ style while "[name].h" is more C style, but in plain C you need the "[name].h" include.
thanks, that fixed it, but now i need to find out how to load the xml files
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
It's possible to add C++ headers in C files (in fact, C and C++ compilers must link objects generated from either one, and are ensured to work):

headerFile.h
Code:
#ifndef __headerFile_h
#define __headerFile_h

#ifdef __cplusplus
extern "C" {
#endif

extern void func1(); //C++ linkage of C source files

#ifdef __cplusplus
extern class someClassName; //C++ linkage of C++ classes.
#endif

#ifdef __cplusplus
}
#endif

#endif //__headerFile_h end

Which means:
Even if this header is added inside a .c file (C source file),
first declaration will link objects from C into C++ (and viceversa -- very important to understand this), while also stripping out the next class declaration, being C++ only.

If you add this header into a .cpp file (C++ source file), both rules will apply and will link correctly.
 
Last edited by Coto,

TheMiningBoyAlpha

Well-Known Member
OP
Newcomer
Joined
Apr 24, 2018
Messages
80
Trophies
0
Age
19
XP
360
Country
United States
It's possible to add C++ headers in C files (in fact, C and C++ compilers must link objects generated from either one, and are ensured to work):

headerFile.h
Code:
#ifndef __headerFile_h
#define __headerFile_h

#ifdef __cplusplus
extern "C" {
#endif

extern void func1(); //C++ linkage of C source files

#ifdef __cplusplus
extern class someClassName; //C++ linkage of C++ classes.
#endif

#ifdef __cplusplus
}
#endif

#endif //__headerFile_h end

Which means:
Even if this header is added inside a .c file (C source file),
first declaration will link objects from C into C++ (and viceversa -- very important to understand this), while also stripping out the next class declaration, being C++ only.

If you add this header into a .cpp file (C++ source file), both rules will apply and will link correctly.
i already fixed it
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan @ BakerMan:
    ubisoft should #stopkillinggames ngl
  • Badcatalex @ Badcatalex:
    sony should #stopkillinggames
  • Badcatalex @ Badcatalex:
    they killed LittleBigPlanet online, which was the main core of every LBP game
  • BakerMan @ BakerMan:
    for real
  • BakerMan @ BakerMan:
    at least with them, it was because of the DDOS attacks, ubisoft was just scummy
  • BakerMan @ BakerMan:
    fuck ubisoft, and fuck activision
    +1
  • realtimesave @ realtimesave:
    Nintendo needs to release a new console, switch is getting such shitty little games lately lol it's pathetic
  • Purple_Heart @ Purple_Heart:
    Lmao a new flashcart... The Unlock Switch... I knew it's not fake xD
    +1
  • NinStar @ NinStar:
    A new consoles won't solve that problem
  • NinStar @ NinStar:
    It will actually make it worse
  • The Real Jdbye @ The Real Jdbye:
    well actually
    a new console won't do anything right now, because the games are still in development, that's why there are few games being released
  • The Real Jdbye @ The Real Jdbye:
    it won't make the games finish any faster
  • Veho @ Veho:
    2/3rds of launch titles for the Switch 2 will just be lazy ports of Switch games anyway.
  • The Real Jdbye @ The Real Jdbye:
    probably
  • The Real Jdbye @ The Real Jdbye:
    maybe mario kart 9 will be a launch title
  • The Real Jdbye @ The Real Jdbye:
    i really want a new mario kart
  • Veho @ Veho:
    What, you mean the endless stream of DLCs doesn't count?
  • Veho @ Veho:
    Why develop a new game when you can just sell season passes forever?
  • Veho @ Veho:
    I'm still on MKDS so I'm not bothered :tpi:
  • The Real Jdbye @ The Real Jdbye:
    i like the dlc tbh, i'd like a new game more
  • ZeroT21 @ ZeroT21:
    but the current version is still selling fine at full price
  • SylverReZ @ SylverReZ:
    Hello
  • ZeroT21 @ ZeroT21:
    sup
    +1
  • SylverReZ @ SylverReZ:
    @realtimesave, You seen the Unlock Switch flashcart yet?
  • K3Nv2 @ K3Nv2:
    I'll see the 19.0 update that blocks use ability to it
    +1
    K3Nv2 @ K3Nv2: I'll see the 19.0 update that blocks use ability to it +1