Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » verify build setup(c++ build via script)
verify build setup [message #789729] Fri, 03 February 2012 10:30 Go to next message
gr www is currently offline gr wwwFriend
Messages: 3
Registered: February 2012
Junior Member
Hi,

I'm used to codeblocks on linux and visual studio on windoze but have just started a new role where its gdb and emacs. I want to integrate the codebase into eclipse so I can do 3 things;

1) Successfully navigate the source (goto declaration, goto definition etc)
2) build source in eclipse
3) launch and debug exe in eclipse.

The setup is such that the existing entry point is a shell script. This does a whole lot of things and cleanly builds the source. The generated exe is debugabble. No issues.

Lets say the build scrips it called build.sh. Calling;

% build.sh LIB1 LIB2 LIB3 PLUGIN1 PLUGIN2 EXE

successsfully does what you would exepect. It sets up variables and calls;

make -f gMakefile

in various dirs after setting various variables. I can then launch gbd on the exe as usual. Everything is debuggable at the command line. There's no eclipse involved. Pure vi/emacs and gdb setup.

QUESTION:

Now I have being trying to get all this into eclipse and I am NEARLY there. I've obviously missed something. After reading various articles on setttup in a makefile based project, I've pointed eclipse to the source, and invoked the script mentioned above. My C++ builde settings are NOT to use default build command but my script with params above. Behaviour is set to

Configuration Default [Active]

Stop on first build error NO
Use parallel build NO
Build on resource save NO

My source builds successfully.

HOWEVER once I go to try and debug things go pear shaped. I want eclipse to use the build thats just successfully completed and to start debugging. However it tries to rebuild the project and compilation errors appear all over the place.

Im guessing that eclipse really does need a make based entry point for its build which means I need to dissect the script such that the variables are set prior to eclipse launch and I then setup the build to do a make -e (from environment variables) etc.

Is that correct? Or do you think that build and debug from a script entry point is doable. For info I'm using the INIGO version of eclipse which seems to be a very powerful too.

thanks and have a nice day

G


Build incremental build NO
Clean NO
Re: verify build setup [message #789859 is a reply to message #789729] Fri, 03 February 2012 13:54 Go to previous messageGo to next message
Robert Pavel is currently offline Robert PavelFriend
Messages: 3
Registered: August 2010
Junior Member
Not 100% sure what you mean by "set up variables"

If you mean include and library paths, I suggest taking a look at your compiler's documentation for how to specify this at the command line.

Either way: Just include it in the rule of the Makefile. It is generally frowned upon in my experience, but it works. It may take some trial and error to make sure the commands are for the right shell (I forget if make temporarily uses a different shell), but that is no problem.

Then, instead of needing to call ./build.sh, you just type "make build" (and, obviously, tell Eclipse to use the rule "build" or whatever you name your rule). You can even recursively call make from make (for subdirectories).

Or, if you are REALLY lazy, try and just have the rule call your existing script.

That being said, I suggest looking into cmake. I suspect it does what you want AND it is a much more automated process (that even allows for portability across platforms in many cases).
Re: verify build setup [message #791994 is a reply to message #789729] Mon, 06 February 2012 13:49 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
You can use whatever command you like to build your project. There is no need to use make.

Does your build script give any output on the build console in Eclipse?
Did it actually build something in the first try? (clean everything and build from within Eclipse)
Did you specfiy the correct build path in Project Properties->C/C++ Build: Build lcoation


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:Problem using Debug to inspect callstack
Next Topic:Making an existing project compile
Goto Forum:
  


Current Time: Fri Apr 26 23:18:25 GMT 2024

Powered by FUDForum. Page generated in 0.04437 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top