1

Well I have been developing an application in C++ with netbeans. Now comes the time that I want to use different tools to measure/test/improve my app, for example "valgrid" or a profiler. Netbeans has created a .o file for every pair of .h and .cpp classe I have plus the main.cpp. How do I link all this to run them from command line? On the run should I be thinking of the external libraries I added? I just need to find the executable and run it from command line.

Thanks ;)

1 Answer 1

5

You should be looking at writing a makefile. Here's a tutorial.

Sign up to request clarification or add additional context in comments.

4 Comments

To simply link everything into an executable you can use g++ <all your .o> main.cpp
Well the idea is that netbeans creates multiple makefiles...and the only executable I find is just running something different, from what it is suppose to run!I might look into making a makefile of my own then, or dig in to the makefile of netbeans.
IDE generated makefiles are often confusing or hard to read. I don't know Netbeans but Eclipse will generate a makefile for Release and one for Debug. I'd recommend you write your own makefile, it's not hard after you get used to it :)
It seems that it is also the way to go for understanding where everything that you link to is place and etc. I am looking at the release makefile now because I am at the end of this project but I might end up doing it from scratch. Thanx leo ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.