c++ help
-
i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ? plus, can i add a third party compiler in a my program ?
-
i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ? plus, can i add a third party compiler in a my program ?
-
i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ? plus, can i add a third party compiler in a my program ?
The simplest way is feeding an actual compiler with the code. You may use system[^], or ShellExectute[^], CreateProcess[^] for running the actual compiler. You can add a third party compiler to your application if the compiler's license allows it (I suppose you'll find a C compiler with such a liberal license).
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite
-
Compile them into what? The compiler will turn source into object code, but that object still needs to be linked to the system libraries in order to run. Maybe you need to provide more information about exactly what your application is supposed to do.
well, the application should have a compiler or compiling system for simple codes and i want to know if i can add a compling system to any application. If there is a way , please reply , Thanks for the reply anyway.
-
The simplest way is feeding an actual compiler with the code. You may use system[^], or ShellExectute[^], CreateProcess[^] for running the actual compiler. You can add a third party compiler to your application if the compiler's license allows it (I suppose you'll find a C compiler with such a liberal license).
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite
can you provide some info on adding compiler in my system, it would be great. Thanks for the reply.Your help was appreciated.
-
can you provide some info on adding compiler in my system, it would be great. Thanks for the reply.Your help was appreciated.
Member 11227854 wrote:
can you provide some info on adding compiler in my system
...you just have to install it... :doh:
-
Member 11227854 wrote:
can you provide some info on adding compiler in my system
...you just have to install it... :doh:
sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .
-
sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .
The compiler will be an external process (see above message from CPallini) for example, on windows you could do something like : If you edit the file in your own application, then you will need to save it on disk before compiling it.
// cl.exe is the windows compiler.
// yourfile.cpp is the source file you want to compile
system("cl.exe yourfile.cpp");After that works (calling the compiler), you can try catching the compiler result (in case of errors and warnings) and display that to the user. This will work for simple 1 file program (with a valid
main
), if you want to compile and link multiple files (like visual studio do), then you will have to do a lot more work (using some sort of "make file"). Good luck. Max.I'd rather be phishing!
-
well, the application should have a compiler or compiling system for simple codes and i want to know if i can add a compling system to any application. If there is a way , please reply , Thanks for the reply anyway.
Member 11227854 wrote:
i want to know if i can add a compling system to any application.
Short answer: No. Longer answer: It is possible to compile a complete module by calling out to a compiler from an application via
ShellExecute
or similar. But just compiling simple statements in isolation would entail a very large amount of work. -
sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .
Member 11227854 wrote:
...i am building a application that contains a compiler and i want to know how to add it. I am still a newbie...
Those two things typically do not go together well, at least not without a lot of prior knowledge. How about a less ambitious project (or two) to get you acquainted with C/C++/MFC development?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles