How to view a .cpp file after preprocessor changes it

Hello. I am having some trouble including iostream etc. when compiling a test
3ds homebrew... And I want to know how I could get a code file that has
iostream, and everything included in iostream, already written into it, like what the preprocessor does when the #include keyword is found. Where can I change the settings in Visual Studio 2019 to not delete the file after the preprocessor changes it?

Sorry if I didn't clarify enough.






Thanks.
Last edited on
With cl.exe??

I tried it and nothing happened.

EDIT: I tried /P and it made a .i file, but how do I compile it as a .3dsx ( Nintendo 3ds executable)?
Last edited on
Can .i files be compiled?
To answer your question, we'll need a link to the homebrew SDK you're using.
Umm You mean devkitPro?
Is devkitPro an SDK? I use devkitPro, but all the built in .h files are for C programs...
No iostream, no string, etc.

https://github.com/devkitPro/installer/releases
Last edited on
Well, then why are you asking about Visual Studio?

It's not uncommon for new SDKs to be missing libraries. You can only use libraries that the SDK includes. If the SDK doesn't include a library and you need it then your own option is to implement it yourself on top of existing interfaces. <iostream> for example can be implemented on top of stdio.h.
https://devkitpro.org/wiki/Getting_Started

I don't see any support for Visual Studio, only MSYS2.
https://www.msys2.org/wiki/MSYS2-introduction/

MSYS2 provide a *nix-like shell environment for Windows, so any compiling is done command-line. With command-line compiling you can keep processed source files after the pre-processor is done mucking around with them.
Yeah, but I want to know if I can somehow use
iostream
or
string
with devkitPro because it only has C header files.
Well, then why are you asking about Visual Studio?


Because I want to use the header files from Visual C++ because devkitPro only has C headers.

It's not uncommon for new SDKs to be missing libraries.


It's not new.
I want to be able to make a .3dsx/.cia etc. file with C++ other than C.

So I thought that if I wrote the included files from Dev-cpp or any other C++ IDE into my .cpp file (aka used the preprocessor on it), I could then simply build it in the right format.

I guess I was wrong.
Last edited on
So I thought that if I wrote the included files from Dev-cpp or any other C++ IDE into my .cpp file (aka used the preprocessor on it), I could then simply build it in the right format.
That might or might not work. It depends on how the headers are written. In all likelihood, it won't.
Headers that are often portable across compilers are generic ones, such as <memory>, <vector>, <string>, etc. I've used such MSVC headers with Clang and it worked just fine, but for example <iostream> and other I/O headers I couldn't get to work at all. I kept getting linker errors.
Isn't there some sort of way to compress headers into one file before compilation of the program? Like a .h file with iostream and all the files it includes written in with it?
Topic archived. No new replies allowed.