How to view a .cpp file after preprocessor changes it

Oct 4, 2020 at 7:06pm
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 Oct 4, 2020 at 7:06pm
Oct 4, 2020 at 9:44pm
Oct 5, 2020 at 12:41am
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 Oct 5, 2020 at 12:54am
Oct 6, 2020 at 5:11pm
Can .i files be compiled?
Oct 6, 2020 at 11:47pm
To answer your question, we'll need a link to the homebrew SDK you're using.
Oct 7, 2020 at 6:01am
Umm You mean devkitPro?
Oct 7, 2020 at 6:03am
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 Oct 7, 2020 at 6:04am
Oct 7, 2020 at 3:22pm
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.
Oct 7, 2020 at 8:02pm
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.
Oct 8, 2020 at 12:00am
Yeah, but I want to know if I can somehow use
iostream
or
string
with devkitPro because it only has C header files.
Oct 8, 2020 at 12:03am
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 Oct 8, 2020 at 12:07am
Oct 8, 2020 at 1:36am
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.
Oct 9, 2020 at 1:42am
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.