How to compile C++ codes in Linux with source files hidden? [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 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.

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 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

How to extract files from C++ program and then run one from them [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 6 years ago.
Improve this question
I'm writing updater program in C++, i need extract files from them.
I'm using Microsoft Visual Studio.
What I'd like the achieve:
User runs exe
exe unpacks files
exe runs one of extracted files
Can anyone recommend a good solution?
Thanks!
Extracting resources from a file with C++:
Extract file from resource in Windows module
Self-Extracting Executable C++
http://www.codeproject.com/Articles/4221/Adding-and-extracting-binary-resources
You're writing an updater.
User runs exe
exe unpacks files
exe runs one of extracted files
So your program should:
Download the patch from the server (use a networking library like winsock or something higher-level)
Unzip the archive (depending on the format in question, there should be libraries for that, like zlib)
Move the new files and overwrite the old ones (use win32 or something higher-level like MFC or Qt)

Editing this Qt program (C++) I think [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 years ago.
Improve this question
I am working on a raspberry pi project that I have picked up from a previous groups work.
It seems that the program used to control the raspberry pi has been compiled and we can run it fine, however there is no original source code (C++) or any project files for Qt as far as I can see, below is a copy of the folder, is there any way to get at the source code using Qt or something else?
We want to be able to make changes to the program.
There is no documentation on the build of the software, only indication on how to run it which we can do fine, I am trying to track down the authors but to no luck.
What can I try? I tried opening the files here with http://codelite.org/.
All of the object files and the turbo_gui file just contain one line: ELF SOH SOH SOH
On the image you posted, the directory is a Qt build directory, not a source directory.
The folder you showed contains some source files automatically generated by Qt, some compiled .o files and a linked binary, but not the original source code.
If the authors didn't publish the original C++ source code, there is no way to get the exact source code back. You should ask the authors to send you a copy of the source code.
If there is no way to get the source code, the best you can do is use a disassembler or decompiler (such as Hex-Ray's plugin for IDA) to get an idea of how the code works, then reimplement it yourself.

How do I get project root directory? [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 years ago.
Improve this question
For example, if my project directory is /media/code/clojure/my-project/ and I have a file /media/code/clojure/my-project/src/foo.clj, how can I get "/media/code/clojure/my-project/" from foo.clj?
This is unfortunately not possible because the idea of a "project root" is not well defined in the Java package model. There is a the idea of "the root of the source for this project" though once/if it's compiled into a jar file this concept no longer applies, the jar file could be loaded form anywhere on the system and that location will almost always (in the case of distributed software) be a system package installation directory. This would be an inappropriate place to download files to.