Include files without #include [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
it is possible to include headers files intro visual studio wihtout #include preprocessor ?
I mean, i have a .cpp intro a visual studio project, and i don't want to use #include intro header file or source file. I want to be included automatically.
I mean some Windows header files are included automatically.. Soo i think is possible with files from my project too..
Best regards.

Having some kind of global include files ain't what is recommended in C++ as you can't reason about dependencies anymore. Though it is possible with the Visual Studio compiler by using the /FI command line option.

Related

How to use Resources in c++? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
I want to put an exe file in my C++ program, but I don't understand how to do it.
I am using Visual Studio 2019. I know that it can be done through project resources, but I don't know how to work with it.
Create an .rc file to refer to the desired embedded .exe as an RCDATA resource, eg:
MYEXE RCDATA "path\to\file.exe"
Add the .rc file to your project.
The referred .exe file will then be compiled into your final executable.
You can then access the MYEXE resource at runtime using the Win32 FindResource()/LoadResource()/LockResource() functions, or higher-level framework equivalent.

How to include audio and picture into .exe ( Visual Studio ) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Does anyone know how can I include a picture and a .wav file into my .exe file? ( C++ )
If i run the build PlaySound(TEXT("Audio.wav"), NULL, SND_FILENAME | SND_ASYNC); it will work well, but if a another person opens the .exe where the .wav file is not in the same direction the sound won`t play, how can i include the audio into the .exe?
Firstly, I suggest you could try to add the files to your project as resources, then you could try to use PlaySound function to use them.
I suggest you could refer to the thread:PlaySound works in Visual Studio but not in standalone exe

gl.h included before glew.h [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to use opengl library in my main file. when I compiled it, an error message occurs that "gl.h is included before glew.h"
Firstly, I checked the build messages which file is including gl.h before including glew.h.
As a result, I found qopenglbuffer.h is including gl.h and it is included before including glew.h
But qopenglbuffer.h is library files.
Secondly, I added glew.h at forced include file list but it's not working.
I don't know how to fix this problem but I will keep trying to fix it.
Does someone Know how to fix this issue?
If you're already using Qt's OpenGL support you don't need GLEW.
See QOpenGLContext::versionFunctions and QOpenGLContext::extraFunctions to access OpenGL functions.
I finally fixed the problem. it caused included header file order.
I have used precompiled header to manage header files easily.
so, I included glew.h before gl.w in my precompiled header thank your comments were really helpful. :)

How to compile C++ codes in Linux with source files hidden? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Is there anyway to compile C++ source files in Linux and make these files unreadable to users? Either have the files encrypted or read them into memory is acceptable.
We are developing a Linux based software and we don't want our users to have direct access to our source code files.
Once a binary is created from C++ source files, the original source files are not needed in order to run the program. You can distribute only the compiled program.
Just build a container image with your software and its dependencies and run it anywhere. No need to distribute sources or compile for specific distributions.
You can use Flatpak or Docker, for example.

How to compile code from other compilers in VS 2017 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have downloaded a source code and can't get my head around to how can I compile it/open it in VS 2017. It should have been straight forward but nothing worked until you create a new project. If I just open a C file in VS, it just show me the file and there's no way to run it. Imagine I wrote a simple Hello World in C and I have its C file. How could I open and run it in VS? The only way I found was to create a new project and copy/paste the code from my C file into the newly generated file by VS. This gets extremely inefficient with large projects having multiple C/h files :/
Yes, you should Create a New project -> Visual C++ -> Empty Project. After that, you will see in the solution explorer (Resource files, Header files, and Source files) folders. Right click on Header files and Then Add -> Add existing items, Then you can select multiple header files. Follow for source files same as header files that you Added