User forums > Using Code::Blocks

How to add compiler information

(1/1)

Psyclone:
Greetings, I have successfully compiled a program at the command but would like to compile it in code blocks. The following is the command line I used...

g++ -Wall -D__WINDOWS_DS__ -o audioprobe audioprobe.cpp RtAudio.cpp -lole32 -lwinmm -ldsound

Where do I enter this information in codeblocks to get the project to compile?

Thanks in advance, sorry if its an obvious or nonsensical question.

BlueHazzard:
you have
precompiler defines:

--- Code: ----D__WINDOWS_DS__
--- End code ---
compiler flags:

--- Code: ----Wall
--- End code ---
and linker libraries

--- Code: ----lole32 -lwinmm -ldsound
--- End code ---

Pre compiler commands:
Project->Build options->Select the project name on the left->compiler settings->#defines
add "__WINDOWS_DS__" without the -D

Compiler commands:
Project->Build options->Select the project name on the left->compiler settings->compiler flags
search for Wall in the list
or
Project->Build options->Select the project name on the left->compiler settings->other compiler flags
add "-Wall"

Linker libraries
Project->Build options->Select the project name on the left->Linker settings->link libraries
press the "Add" button at the bottom and enter the libraries without "-l" so for your example

--- Code: ---ole32
winmm
dsound
--- End code ---
for each library you have to press the add button

if you have a problem: https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

hope this helped

Psyclone:
Thanks so much.

One more question, I'm guessing this is how it works...

if I write a #defines  __WINDOWS_DS__  at the top of a file it will add the following code to the file. 

The "#if defined" below is asking if I wrote the "#defines" above? Thanks again for you help.

CODE....
#if defined(__WINDOWS_DS__) // Windows DirectSound API

// Modified by Robin Davies, October 2005
// - Improvements to DirectX pointer chasing.
// - Bug fix for non-power-of-two Asio granularity used by Edirol PCR-A30.
// - Auto-call CoInitialize for DSOUND and ASIO platforms.
// Various revisions for RtAudio 4.0 by Gary Scavone, April 2007
// Changed device query structure for RtAudio 4.0.7, January 2010

#include <windows.h>
#include <process.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <dsound.h>
#include <assert.h>
#include <algorithm>

#if defined(__MINGW32__)
  // missing from latest mingw winapi
#define WAVE_FORMAT_96M08 0x00010000 /* 96 kHz, Mono, 8-bit */
#define WAVE_FORMAT_96S08 0x00020000 /* 96 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_96M16 0x00040000 /* 96 kHz, Mono, 16-bit */
#define WAVE_FORMAT_96S16 0x00080000 /* 96 kHz, Stereo, 16-bit */
#endif

#define MINIMUM_DEVICE_BUFFER_SIZE 32768

Miguel Gimenez:
If you add __WINDOWS_DS__ to the project, it will be defined in every compilation command.
If you define it in a file, it will be defined only during current compilation command.

Read about preprocessing elsewhere, this is OT here.

Navigation

[0] Message Index

Go to full version