Author Topic: Using code::blocks w/o a project  (Read 6205 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #15 on: January 28, 2024, 10:39:52 pm »
But notice that your compiler is acting differently from mine.
Is your bash script outputing to a different location than CB expects?

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #16 on: January 28, 2024, 10:42:52 pm »
I don't use a bash script. My default shell is zsh, but I set C::B to use bash thinking that maybe it didn't play nice with zsh or visa-versa!
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #17 on: January 28, 2024, 10:45:37 pm »
Check, that on output, the .o file is sitting in the same dir as the .c file.
You don't get the option of moving the .o or executable when not using a project.

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #18 on: January 28, 2024, 10:46:54 pm »
OK - will do!

C::B is not cranking out a `.o' file at all or `gcc' I should say!
What gives?
« Last Edit: January 28, 2024, 10:51:27 pm by dukester »
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #19 on: January 28, 2024, 10:59:32 pm »
Right click on Build log tab and copy paste here.
The same for the Build messages.

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #20 on: January 28, 2024, 11:02:50 pm »

-------------- Build: Debug in HelloWorld (compiler: GNU GCC Compiler)---------------

gcc -Wall -g -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/HelloWorld -I/home/dnormandin/programming/c/code/HelloWorld/ -c /home/dnormandin/programming/c/code/HelloWorld/main.c -o obj/Debug/main.o
gcc  -o bin/Debug/HelloWorld obj/Debug/main.o  -O2 -m64 
/usr/bin/bash: gcc -Wall -g -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/HelloWorld -I/home/dnormandin/programming/c/code/HelloWorld/ -c /home/dnormandin/programming/c/code/HelloWorld/main.c -o obj/Debug/main.o: No such file or directory
Process terminated with status 127 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))


 ||=== Build: Debug in HelloWorld (compiler: GNU GCC Compiler) ===|
 gcc -Wall -g -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/HelloWorld -I/home/dnormandin/programming/c/code/HelloWorld/ -c /home/dnormandin/programming/c/code/HelloWorld/main.c -o obj/Debug/main.o||No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #21 on: January 28, 2024, 11:10:52 pm »
You're using a project? The Debug target?

I thought we were working on NO project builds.
Lets simplfy. Start over and use only the build process I used.
We can get to projects a little later.

I want to know that a no-project plan works first.

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #22 on: January 28, 2024, 11:13:38 pm »
You bet! Sorry about that ...
--
Duke

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #23 on: January 28, 2024, 11:21:27 pm »

-------------- Build file: "no target" in "no project" (compiler: unknown)---------------

gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o
gcc  -o /home/dnormandin/programming/c/code/temp/HelloWorld /home/dnormandin/programming/c/code/temp/HelloWorld.o  -O2 -m64 
/usr/bin/bash: gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o: No such file or directory
Process terminated with status 127 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
Checking for existence: /home/dnormandin/programming/c/code/temp/HelloWorld

-------------- Build file: "no target" in "no project" (compiler: unknown)---------------

gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o
gcc  -o /home/dnormandin/programming/c/code/temp/HelloWorld /home/dnormandin/programming/c/code/temp/HelloWorld.o  -O2 -m64 
/usr/bin/bash: gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o: No such file or directory
Process terminated with status 127 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

||=== Build file: "no target" in "no project" (compiler: unknown) ===|
 gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o||No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #24 on: January 28, 2024, 11:29:32 pm »
Is there an actual HelloWorld.o sitting in the source dir along wth HelloWold.c ?

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #25 on: January 28, 2024, 11:33:52 pm »
~/programming/c/code/temp
ls -al HelloWorld.*
-rw-r--r-- 1 dnormandin dnormandin 161 Jan 28 15:18 HelloWorld.c

find ${HOME} -name HelloWorld.o -print
« Last Edit: January 28, 2024, 11:36:58 pm by dukester »
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #26 on: January 28, 2024, 11:38:49 pm »
Ok, so the compiler is acting up.
Lets get rid of those extra compiler settings.

In your compiler settings, uncheck
-std=c99 -m64 -Og -O2
from both the compiler and the linker options.
until you don't see them in the logs.
 

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #27 on: January 28, 2024, 11:43:37 pm »
Whoa! I just copied the gcc instructions issued by C::B (from the Build Log output) - and pasted into the /temp directory where HelloWorld.c lives. No probs - I've now got a HelloWorld.o file.

I'll run the 2nd gcc line and I bet I'll get an executable.
--
Duke

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #28 on: January 28, 2024, 11:46:21 pm »
Nope! I got a linking error:

gcc  -o /home/dnormandin/programming/c/code/temp/HelloWorld /home/dnormandin/programming/c/code/temp/HelloWorld.o  -O2 -m64
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #29 on: January 29, 2024, 12:04:24 am »
There something weird in your build log.
Code
gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o
gcc  -o /home/dnormandin/programming/c/code/temp/HelloWorld /home/dnormandin/programming/c/code/temp/HelloWorld.o  -O2 -m64
/usr/bin/bash: gcc -Wall -std=c99 -m64 -Og  -I/home/dnormandin/programming/c/code/temp -I -c /home/dnormandin/programming/c/code/temp/HelloWorld.c -o /home/dnormandin/programming/c/code/temp/HelloWorld.o: No such file or directory
Process terminated with status 127 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

What is that line that begins with "/usr/bin/bash". What the heck is that??
Look at my Build log. there are only two lines. And nothing to do with bash. That line is wiping out your .o file.
Code
gcc   -c /home/pecan/Temp/HelloWorld.c -o /home/pecan/Temp/HelloWorld.o
gcc  -o /home/pecan/Temp/HelloWorld /home/pecan/Temp/HelloWorld.o   
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
Checking for existence: /home/pecan/Temp/HelloWorld
Executing: 'xterm -T '/home/pecan/Temp/HelloWorld' -e '/usr/bin/cb_console_runner' '/home/pecan/Temp/HelloWorld'' (in '/home/pecan/Temp')
Set variable: LD_LIBRARY_PATH=


[/code]