how can build options be changed in code::blocks? - c++

I recently started using code::blocks, so I'm a newb here.
I am writing a game, in SDL with C++ and all of the code I am writing depends on the build options similar to this: g++ -Wall -o "%e" "%f" -lSDL -lSDL_image
Code::Blocks seems to work fine when I select to start a NEW SDL project, and convert my programs to project files. However, I have many source files, and I dont want to convert them all to project files, I would rather just change the build options for code blocks.
I am using version svn 10528, on Linux if that helps. I have formerly been using geany, which was very simple to change, and set build options in.

Ok, I found it, In Code::Blocks, go to Project> Build options
a window appears. it lists build options.
right click on that and add new. from there you can give it a name, add compiler options, and add linker options.
save it and youre done.
I saw some errors in the IDE when trying to use this, and found if you click continue it works fine. if you click cancel, the IDE crashes.

Related

How to set compiler options in Arduino Eclipse IDE?

I installed the Arduino Eclipse plugin, and created a new project. I want to compile my code with the -std=c++11 option, but by default Eclipse does not use that option. Under Project Properties, for other C++ projects build options can be set in the C++ Build tab, but it is missing for my Arduino project. Is there any way to set the build options?
I recently installed this plugin, and I wanted to do the same thing, in order to generate mixed C and Assembler listing. In summary, (This is for OSX, you will have to figure out the paths if you are on a different platform.)
Look in /Users/concunningham/.arduinocdt/packages/arduino/hardware/avr/1.6.23 for a file called platform.txt.
In there you will find a line like this:
compiler.cpp.extra_flags=-Wa,-adhln -g > "$<".lst
You can see I added "-Wa,-adhln -g > "$<".lst" as extra options for the cpp compiler.
Now, this is key - restart Eclipse, clean the project in question, and rebuild. You should see your extra options take effect. Peep at the makefile to be sure.

Why is CodeBlocks 13.12 giving the following two errors during debug?

I am new to CodeBlocks. I am using CodeBlocks 13.12, along with the included Mingw GCC compiler, and I am getting the following 2 errors:
Probably a little more useful: The build log -
The project is just a simple "Hello World" program right now, and I am just trying to get the libraries setup for use. There are no other errors shown,
and I have not enabled or disabled any compiler options.
I definitely have the main.cpp file in the listed search path.
What. The. Actual.
Also, what does the system mean by "Party"?
Ok. The answer is I am an idiot who didn't check all the output windows.
I didn't properly link the SDL library.
I run into this "can't find .o" error on a semi-regular basis. It could be other things, but the first thing you need to try to do is to delete the obj folder from your project directory and then completely rebuild the project. The Rebuild button is on the toolbar (the two arrows in a circle), next to your Build and Run buttons.
If you're still getting errors, it would depend on your project's paths and how you set it up.

"Unresolved include" errors in c++

I'm a new C++ programmer using Eclipse. Eclipse seems to recognize C++: It let me create a new C++ project and understands the syntax. However, whenever I try to #include anything, I get an "Unresolved include" error.
I have CDT installed. I also just installed MinGW and MySys and set the path variables correctly.
It looks like something's still missing from Eclipse though -- when I right click on my project and go to "properties -> C/C++ build -> Settings" all I can access are the "binary parsers" and "error parsers" tabs. The window should look like this...
...but I can't see the tool settings, build steps or build artifact tabs.
That's all my research has turned up so far. What should I do next?
Settings on screenshot related to build process. For correct work editor (autocomlete, includes) you need to set same dirs in the C/C++ General/Paths and symbols, includes, GNU C++. Also, if path variable containt dir with g++ ecplise should to have prepared configuration if you choose mingw toolchain while creating project.
Update for comment

"Program is not a recognized executable" error in Eclipse

I'm trying to debug a C++ programme in Eclipse Indigo. The project is using autotools/configure (and the respective plugin) as build system.
After successful build I right-clicked on the binary in the project browser and chose "Debug As". Then I used the file browser to select the binary. Clicking on "Debug" then opens a dialog which just says "program is not a recognized executable".
Any ideas?
I found the answer: the binary parsers configured in eclipse were the wrong ones. Adding the correct binary parser under Project --> Properties --> C/C++ Build --> Settings solves he problem.
If you're using libtool in your project, what looks like the binary may actually be a wrapper script used to set LD_LIBRARY_PATH and stuff like that before executing the real binary (which is stored in the .libs directory). This may be what causes Eclipse to fail, but I'm not sure how you should go about fixing that.
There seem to be a bit of documentation about Eclipse CDT and libtool on the internet which may have the infos you need though: http://www.freerdp.com/wiki/doku.php?id=eclipse#debug_configuration
From OSX snow leopard on, gcc seems to build 64 bit executables by default. And those won’t be recognized from Eclipse in return. To solve the error, you’ve got to explicitly set your architecture to i386.
Enter your project properties and add the command line option “-arch i386″ for each C++ Linker, C++ Compiler and C Compiler. After a clean build, you should be clear to debug again. In Linker options make sure to NOT set it up as -Xlinker option.
Original Source

Netbeans C++ additional commands (using tolua++)

I am building a C++ project that uses tolua++ for binding.
When building 'by hand'. at the command line, I am entering the following command:
tolua++5.1 -o ../src/LuaBinding.cpp -H LuaBinding.h Binding.pkg
I don't know where to enter this command line in the Netbeans IDE.
Can anyone help?
Depending on how you created the project, you might have a Makefile. (For example, if when creating the project, you selected "C/C++ Application" then NetBeans created a Makefile for you.)
In the Project pane, you would have a node called Important Files, and in there should be Makefile. I am assuming you can put what commands you need into the Makefile. The makefile NetBeans gives you in Important Files actually allows you to augment its own standard makefile targets by adding commands to the pre and post targets. To get more control over the make process you could replace NetBeans' make files with a completely custom set. That would mean that you would need to hook up your own targets to menu commands--not rocket science but beyond the scope of this answer.
If it is more general than that... if all files are built with tolua++, then you can establish it Build Tools Tool Collection. Click on Tools, then Options, then click on the C/C++ icon in the Options dialog's toolbar, and then on the Build Tools tab. In that case, the standard NetBeans makefile (or whatever custom makefile you've provided) will simply use that without having to muck through the makefile itself.