-2

What kind of software or programming language that I've to learn for creating single executable program without any .dll or other formats independently?

Any suggestion I would appreciate!

Marfin. F
  • 434
  • 4
  • 16
  • If you want something that is really portable think about using something that runs on a VM like Java or python. – NathanOliver May 12 '17 at 12:00
  • Your'e asking for opinions about a very broad problem. That's very off-topic. – StoryTeller - Unslander Monica May 12 '17 at 12:05
  • 1
    The question doesn't make much sense. Visual Studio doesn't require any kind of signing up. When you create a new C++ project it asks you immediatelly whether you want it to be statically or dynamically linked. It can also generate and compile projects for Linux. – Panagiotis Kanavos May 12 '17 at 12:06
  • 2
    You are asking about an XY-Problem. C++ can do this. If you have problems doing it, **ask a question about those problems**. – nvoigt May 12 '17 at 12:06
  • What did you try and what was the problem? Asking as a developer that used Visual Studio back in 1996 to generate statically linked programs. The question about static/dynamic linking is right there in the project creation page – Panagiotis Kanavos May 12 '17 at 12:07
  • @PanagiotisKanavos http://s.pictub.club/2017/05/13/7kQPLo.png There tells me An error occurred while signing: SigningTool.exe was not found.... – Marfin. F May 12 '17 at 13:14
  • @NathanOliver Sounds like a good idea! I have Netbeans IDE 8.2 to run java program instead of VM. I don't know yet how to run Java on VM tho. – Marfin. F May 12 '17 at 13:16
  • @nvoigt Then what kind of software that compiling this to be executable program? – Marfin. F May 12 '17 at 13:16
  • 2
    Visual Studio for example. Or virtually any other compiler toolchain. You are assuming because you got errors that it's not possible. Consider that errors might simply mean you did it wrong. Your question should be how to do it right instead of using another tool. – nvoigt May 12 '17 at 13:18
  • @Marfin.F that's irrelevant to the question. If you don't want to sign your exe, don't sign your exe. This has nothing to do with compilation. Maybe you checked signing by mistake, maybe you've got your environment variables mixed up. – Panagiotis Kanavos May 12 '17 at 13:44
  • I would vote your answer as true answer if you post in answer section. And I apologize for not posting a proper question. And if you don't mind, please tell me how to fix the error which it happened in my visual studio 2015 in answer section then I'll vote it as correct answer! Thank you – Marfin. F May 12 '17 at 13:45
  • Duplicate questions [Visual Studio SignTool.exe Not Found](http://stackoverflow.com/questions/31833142/visual-studio-signtool-exe-not-found) and [An error occurred while signing: SignTool.exe not found](http://stackoverflow.com/questions/7548342/an-error-occurred-while-signing-signtool-exe-not-found) – Panagiotis Kanavos May 12 '17 at 13:49
  • @PanagiotisKanavos I unchecked the signtool and I got http://s.pictub.club/2017/05/13/7kQOvL.png manifest application file instead of executable format. I don't know how to compile program to be executable program in Visual Studio. I researched the game maker application can make only single executable file when we export it. https://i.stack.imgur.com/QHMRU.png. – Marfin. F May 12 '17 at 14:05

3 Answers3

3

It is operating system specific (and not defined by the language itself). Read more about linkers.

You may want to use C++11 (or C++14) and instruct your C++ compiler to statically link your executable. So you should read the documentation of your compiler; with GCC you could pass -static to the g++ command.

You may also want to use the Go language. The usual compiler for Go is trying to generate statically linked executables.

BTW, a statically linked executable still have dependencies, e.g. to its operating system kernel (and perhaps utilities and some system files) : obviously, a statically linked executable for Windows won't run on Linux.

(for instance, on Linux, any program using the standard system(3) function silently depends upon /bin/sh....)

In practice, I generally would not recommend statically linking the C standard library, but YMMV.

Of course, you need some source code editor to write your code (I prefer GNU emacs). Some people are using IDEs, but I prefer to run explicitly the compilation command (perhaps using some build automation tool like GNU make).

(notice that DevC++ or CodeBlocks is an IDE, not a compiler)

NB: I recommend reading Operating Systems : Three Easy Pieces (freely downloadable, each chapter has its own PDF file) to understand more about operating systems.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • 2
    All C++ compilers generate statically linked executables too. Including Visual Studio. It's just a project setting – Panagiotis Kanavos May 12 '17 at 12:04
  • 1
    I did tell that in my second paragraph. – Basile Starynkevitch May 12 '17 at 12:06
  • Speaking about Go Language, you've said that The usual compiler for Go is trying to generate statically linked executables. Did you mean the single executable can be placed in any directories and it generates automatically linked to library which can support go compiler? Or it existed inside .executable program itself? Sorry, I am still noob about compiler, dll, any kind connected to the basic program. – Marfin. F May 12 '17 at 13:24
  • @BasileStarynkevitch The GNU emacs seems the properest answer but is GNU emacs compiler? Does it make executable file? – Marfin. F May 12 '17 at 13:28
  • It just means that (e.g. on Linux) the `go install` command would compile and install a statically linked executable (like `-static` does with `gcc` ....). And GNU `emacs` is an (excellent) *source code editor*, not a compiler. – Basile Starynkevitch May 12 '17 at 13:28
  • 1
    @MartinF you really should take several days to read the *Operating Systems : Three Easy Pieces* book. Because you look confused. We don't have the place and time to explain here all that is said in that book. – Basile Starynkevitch May 12 '17 at 13:30
  • I will consider that, sir. It might be the most I really need it to make only single .executable program – Marfin. F May 12 '17 at 13:49
  • But you need to understand why you need this. – Basile Starynkevitch May 12 '17 at 13:52
  • As you can see, I might be just impatient who want to witness how the real executable program created and connected to dll file and other format which it can support. I don't know where should I start tho and those books are not free. – Marfin. F May 12 '17 at 14:12
  • But the *Operating System : Three Easy Pieces* book I am recommending is free to download in PDF format (each chapter has its own PDF file). And I tend to believe that your question is naive (so even with static linking, you could have unpleasant surprises because of your lack of understanding about operating systems). – Basile Starynkevitch May 12 '17 at 14:13
  • Sorry for my dumbest mistake I wasn't trying to find in pdf format. Thanks for your answer sir! And again I apologize!. Yes, I am lacking of operating system and yet it will be my main solution to continue my research about executable file come from. But I've to do from easier as well. And again thank you sir! – Marfin. F May 12 '17 at 14:16
1

A truly independent "executable" is an image that you flash onto an embedded device. Your image may (but doesn't need to) bundle a library such as FreeRTOS that functions as a sort of mini-OS. Other than actual hardware, your program will be entirely self-sufficient.

Otherwise, you are at least beholden to having an operating system in place, with access to the "runtime" support library for your language (although this can often be statically linked) and possibly third party libraries on top of that (which may often be statically linked too).

Sometimes when trying to be self-contained, you go so far in the other direction that actually your "program" is not executable at all, but just a script to be passed through a Python or Go or JavaScript or VBScript interpreter. This is in fact the opposite of self-contained, though it is nice and portable if implementations of that language exist on all your target platforms.

Code that runs on a VM (Java, .NET) is a sort of half-way house between these.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • Though other languages are actually not my executable program at all could you suggest me the language which can create single executable file? And can create my own dll(Build .exe and dll separately with my own code)? I need it so badly to my project research. – Marfin. F May 12 '17 at 13:32
  • @Marfin.F: Read the information already given to you across this whole page. – Lightness Races in Orbit May 12 '17 at 13:47
  • I think I start my research by trying JAVA either in netbeans IDE or VM. I shall try both! – Marfin. F May 12 '17 at 14:13
1

Visual Studio:

Project->'project' Properties

Configuration Properties -> C++ -> Code Generation

Runtime Library -> Multithreaded [debug]

Don't use Multithreaded [debug] DLL

Also, set [debug] for Debug build and NOT [debug] for Release build. You can switch between build types with the 'Configuration' dropdown in the upper left corner.

James Poag
  • 2,320
  • 1
  • 13
  • 20
  • http://s.pictub.club/2017/05/13/7kQPLo.png Well sir, I can't find Configuration Properties in myproject properties :( – Marfin. F May 12 '17 at 13:34
  • @Marfin.F: Just Google "signtool was not found", and find this top result: http://stackoverflow.com/q/31833142/560648 You probably don't need to "Publish", anyway. – Lightness Races in Orbit May 12 '17 at 13:48
  • @BoundaryImposition If Publish is not necessary to make .executable program, could you tell me the other way, sir? – Marfin. F May 12 '17 at 13:52
  • 1
    It would be better if you read the documentation. This is not the correct place to teach you everything about how to create and build software. – Lightness Races in Orbit May 12 '17 at 13:56