Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am a Netbeans user and willing to write CGI scripts in C++ by using Netbeans IDE. Assuming that every CGI script will need a separate main() function. How can I build the entire project?

Thanks

share|improve this question
Have you investigated using an external build tool such as make? This would have the advantage of being able to compile the code on other systems and not require the IDE to do a build. Going to a build tool such as make also lets you set up targets for "all" or just a single cgi. – MichaelT Jan 18 at 20:28

closed as not a real question by gnat, GlenH7, Glenn Nelson, Walter, Dynamic Jan 18 at 22:13

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

Why do you need seperate program? Can't you use a single program as controller checking the request? So that http://example.com/cgi-bin/yourcgi?action=foo calls your function foo() and http://example.com/cgi-bin/yourcgi?action=bar calls bar()? - Depending on your server/environment you might also use nicer URLs.

If you want to have one application per task then you should use multiple dependant projects in NetBeans. Maybe a base library holding common routines and then a project per frontend. Else you might mess with the auto-generated Makefile.

As a sidenote: Why are you bulding CGI binaries? Often one can benefit from using Server-specific modules (i.e. apache httpd apxs modules) If you don't want server-specific code but higher performance (why else would one use C++ for that) you should at least look into FastCGI.

share|improve this answer
"Why do you need separate programs" - a giant C++ CGI wouldn't be the best design. Smaller programs are easier to debug. Putting multiple dissimilar tasks in a single application makes for poor design. – MichaelT Jan 18 at 20:26
It depends on how different they are ... – johannes Jan 18 at 21:19
Indeed it does, but it is a nightmare to have to support an entire site (or even large portions of a site) implemented as query parameters and extra path elements in a single cgi (or .php, or servlet). – MichaelT Jan 18 at 21:28
It can also be quite a nightmare to keep library versions etc. in sync between too many independent libraries ;) As always with software design: Only the one who knows all requirements can decide ... we can only speculate and give ideas – johannes Jan 18 at 21:31
It's client's requirement to make in C++. The query string approach will not always work, specially when there's need of form submission – Volatil3 Jan 19 at 3:07
show 1 more comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.