I have C++ code that depends on boost and other libraries, and therefore this code has a makefile that invokes boost.
I am now trying to start developing this code in codeblocks in linux, so in order to do that I have two basic questions:
(1) How can I import the code into codeblocks as a codeblocks new project? This seems to be a good rec: http://www.programmingforums.org/thread44976.html
(2) How do I invoke the makefile with codeblocks instead of codeblocks trying to compile the code (which it would fail since codeblocks does not know that it needs to invoke boost).
If you decide that you want to use your own makefile, you need to enter the screen from project->Properties and you will see a tick box for 'this is a custom makefile'. Tick this box, make sure the name just above it is the one you want for your makefile. You should also look at project->build options.
It looks like you can set the working directory that is used to run your program in Project > Properties > Build Target > Execution Working Directory. If you set that to the directory where your source files are located, your file should be created in that directory as well.
You need to start with a CodeBlocks project. It’s possible to use either an existing project or create a new project to hold the files. In either case, once you have a project to use, you simply add the files you want to it, set the build options for those files, and then create your application.
How to create a new project using the CodeBlocks IDE? Step-1: Open CodeBlocks IDE and click on File > New > Project. Step-2: Select the application type as a console application and click on Go. Step- 3: Then Click on “NEXT”. Step-4: In the next window, select C as your language and click on next.
How can I import the code into codeblocks as a codeblocks new project? add files recursively. I recommend that you create Code::Blocks project new project at the top-level of you source (and not e.g. in a dedicated ~/codeblocks directory), or else it will show long file paths.
The Makefile:options are used only if the project should use a makefile instead of Code::Blocks' internal build system (see Code::Blocks and Makefilesfor further details). Adding a new build target Switch to the Build targetstab. Click Addto create a new build target and name it Release Small.
How can I import the code into codeblocks as a codeblocks new project?
File > New > Project > Empty project
Create the project, then:
I recommend that you create Code::Blocks project new project at the top-level of you source (and not e.g. in a dedicated ~/codeblocks
directory), or else it will show long file paths.
How do I invoke the makefile with codeblocks instead of codeblocks trying to compile the code (which it would fail since codeblocks does not know that it needs to invoke boost).
Asked at: Is it possible to use an existing Makefile to build a project in Code::Blocks?. For quick reference, the solution is to go to Project > Properties and toggle on the option This is a custom Makefile. Further options can be specified from the same window.
Most projects can be compiled without makefile, so just include files, and if you need extra library include that in project. If your project uses header only boost librarys and you have packet installed libboost-dev (this is on my debian) then it is included automaticaly. Else just use proper library name in settings (I cant remeber if you need to append l to name).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With