Author Topic: Get CodeBlocks to Use a Command Line  (Read 2426 times)

Offline petec

  • Single posting newcomer
  • *
  • Posts: 5
Get CodeBlocks to Use a Command Line
« on: March 21, 2019, 06:27:50 pm »
I am new to:
Raspberry Pi,
Linux,
C code.

But I have done some Java, Visual Basic. and a whole lot of assembly code.

I have a C file that was given to me...call it MyProgram.c.

It contains the includes:
#include <SoapySDR/Device.h>
#include <SoapySDR/Formats.h>
#include <stdio.h> //printf
#include <stdlib.h> //free
#include <complex.h>
#include <liquid/liquid.h>

The person that gave it to me said (on Raspberry Pi using Raspbian and gcc) to use the command line:

gcc -O2 -std=c99 -o MyProgram MyProgram.c -lSoapySDR -lliquid


It executes perfectly and I get the executable MyProgram and it runs fine.

I need to add a lot of code to the file and would like to use the CodeBlocks debug facility so I want to start with MyProgram.c and expand it.  In CodeBlocks I created a project as an empty C project and added a new C source where I pasted the lines from MyProgram.c

When I try to Build I get "undefined reference to...."  every reference to names in either of the SoapSDR includes and the liquid include.

I have tried to get CodeBlocks to use that command line by placing it in:
(1) Settings Global Compiler Settings Other compiler options.
(2) A similar location in the Build options
(3) Project/targets options 
(4) other places that might help.
(can you tell I don't know what I am doing?)


I'm not going to live long enough to do all I want to do.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Get CodeBlocks to Use a Command Line
« Reply #1 on: March 21, 2019, 10:03:03 pm »
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

we need exact error messages and logs... with "undefined reference to...."  we can not help...

Offline hidefromkgb

  • Multiple posting newcomer
  • *
  • Posts: 50
Re: Get CodeBlocks to Use a Command Line
« Reply #2 on: March 22, 2019, 02:54:47 am »
Have you performed these two steps?
Go to Project → Build Options if not.

Offline petec

  • Single posting newcomer
  • *
  • Posts: 5
Re: Get CodeBlocks to Use a Command Line
« Reply #3 on: March 22, 2019, 03:06:17 am »
hidefromkgb,

Thank you.
That worked
I'm debugging rigth now.

It has been a long time....a very long time since I have been helped so expertly on any forum anywhere.

Thanks Again,

Pete
I'm not going to live long enough to do all I want to do.