Hi to all,
Sorry, if I do not put this post in correct place..

I download GCC 4.5.1 compiler program, and I want to upload it (or connect it ) with website to help a users to write codes and compile them and check if they have error or not.

But I don't know how I connect them.

Please can you help me.

Thank to all ...

This could be a bit tricky because you are trying to get a local standalone program (that other people wrote) to talk to something on your website. I think that you might need to have a local program that calls the GCC Compiler, captures the output and then uploads it to your server and initiates a program on the server that will do the analysis and provide the results. This sounds like it could be a pretty difficult project.

The other alternative would be to run GCC on your server and actually compile the code there. It is very unlikely that GCC is made to be run in a multi-threaded environment so you end up having to queue the requests and run them serially; or, run a new copy for every request (which could put a significant strain on the server).

If you are able to figure out how to capture the GCC output and do the analysis, it would be simpler to have a local program to control it. You could have a website to provide additional resources and help information and provide a link to it within the local program. More than that will probably makes it unnecessarily complicated.

thank chrishea ,,

I understood from your post her that the output of GCC is the run of code or the errors which are in the code, then I write another program in server that will do the analysis the result or represent the output in website ..?!

OK, if I use PHP commands exec or shell_exec ,same in this thread,

http://bytes.com/topic/php/answers/576584-calling-gcc-within-php-code

but I think if I use this method, I need to upload GCC Compiler directory in my website , and put the file , which has the code, in path :
gcc /home/username/sourcefile.c
and when I search this path in my GCC folder , I do not find home, Maybe its different edition !!!

If PHP command shell_exec is used only in Linux system ?
this is note from manual PHP:
I don't know how it goes in Windows, but in Linux, shell returns result with a line break at the end, I guess to make it more readable in shell, so don't forget to use trim() to encapsulate the returned result!


Is there some libraries of GCC in APIs ...??


NOTE:
I want doing same this :

http://codepad.org/

Thank for all

You can find a lot of sites with info on installing GCC on a server:
http://lmgtfy.com/?q=install+gcc+on+server

GCC isn't multi-threaded so you will have to deal with that. For more than a simple program, I think that you also have an issue with creating a compiling environment that duplicates what the user has on his machine. If it is a structure that has include files and possibly extra libraries that aren't standard, is the user going to want to upload all of that stuff to your server so you can do a compile for him?

I don't think that what you are trying to do is practical. If it was an extension to the GCC compiler that they could install and run automatically (on their own machine) every time they compile, that would be OK. In my opinion, the way that you are trying to do it is just too difficult and won't be successful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.