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

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #30 on: January 29, 2024, 12:14:15 am »
/usr/bin/bash is set in Menu/Settings/General/Environment Settings/General settings

In there I also set the terminal I want to use.
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #31 on: January 29, 2024, 12:20:11 am »
For our tests, set:
shell to run to: /bin/sh -c
Terminal to launch: xterm -T $TITLE -e
Open containing folder: xdg -open

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #32 on: January 29, 2024, 12:24:55 am »
Done!! Re-built w/ following results:


-------------- 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/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
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

||=== Build file: "no target" in "no project" (compiler: unknown) ===|
/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'|
||error: ld returned 1 exit status|
||=== Build failed: 2 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 #33 on: January 29, 2024, 12:27:16 am »
Where did the "/usr/bin/ld: /usr/lib/gcc/x86..." line come from?

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #34 on: January 29, 2024, 12:29:11 am »
From the "Build Messages"
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #35 on: January 29, 2024, 12:31:52 am »
The compiler setting should look like this.

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #36 on: January 29, 2024, 12:37:19 am »
Yup! That's exactly what I've got!

Say - you've been overly kind and generous with your time. I can use the Geany or emacs editor - no problem. C::B was worth a test-drive but you've got a life other than it. Thanks for all the effort!!
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #37 on: January 29, 2024, 12:38:21 am »
Ok, sorry it didn't work out.

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #38 on: January 29, 2024, 12:39:34 am »
👍

Joy!!


-------------- 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 
Output file is bin/Debug/HelloWorld with size 17.47 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

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

Checking for existence: /home/dnormandin/programming/c/code/HelloWorld/bin/Debug/HelloWorld
Set variable: LD_LIBRARY_PATH=.:/usr/share/lib:/usr/lib/x86_64-linux-gnu
Executing: xterm -T HelloWorld -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=/usr/share/lib:/usr/lib/x86_64-linux-gnu:. /home/dnormandin/programming/c/code/HelloWorld/bin/Debug/HelloWorld  (in /home/dnormandin/programming/c/code/HelloWorld/.)
Process terminated with status 0 (0 minute(s), 7 second(s))
 
« Last Edit: January 29, 2024, 12:49:06 am by dukester »
--
Duke

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #39 on: January 29, 2024, 04:12:25 am »
Congratulations, you are tenacious. A sign of a good coder/programmer.

In your leasure time (if there's such a thing) read some of the following in the "projects" section.

Quote

https://www.codeblocks.org/user-manual/
https://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf (this takes some time to load into a browser). Maybe download it instead.

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #40 on: January 29, 2024, 04:20:49 am »
Thx for the URLs! I've got the 2nd one DLed already. I'll read the C::B users manual for sure. BTW, I still can't get C::B to compile a standalone .c file. It appears that it's not sending the linker the correct info on my system. It worked on your VM - so go figure, right? Whatever - I'll just use the project way! Thx again!
--
Duke

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Using code::blocks w/o a project
« Reply #41 on: January 29, 2024, 04:38:05 am »
Thx for the URLs! I've got the 2nd one DLed already. I'll read the C::B users manual for sure. BTW, I still can't get C::B to compile a standalone .c file. It appears that it's not sending the linker the correct info on my system. It worked on your VM - so go figure, right? Whatever - I'll just use the project way! Thx again!

IIRC, the global compiler settings needs the correct compiler to be set as default.
Edit: And, I have no idea if single file option links correctly on Windows; I never tried it.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Using code::blocks w/o a project
« Reply #42 on: January 29, 2024, 04:45:59 am »
Thx for the URLs! I've got the 2nd one DLed already. I'll read the C::B users manual for sure. BTW, I still can't get C::B to compile a standalone .c file. It appears that it's not sending the linker the correct info on my system. It worked on your VM - so go figure, right? Whatever - I'll just use the project way! Thx again!

IIRC, the global compiler settings needs the correct compiler to be set as default.
Edit: And, I have no idea if single file option links correctly on Windows; I never tried it.

Tim S.

I was able to compile, link and run a single source file with CB 20 and the Nightly (no project) on both Windows and Linux (Mint 21.x).
But others cannot.
I don't see why. Must be above my pay grade.
« Last Edit: January 29, 2024, 04:47:55 am by Pecan »

Offline dukester

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Using code::blocks w/o a project
« Reply #43 on: January 29, 2024, 04:46:36 am »
My global compiler setting must be set correctly because it finally compiled the code under the project structure. However, for some reason it refused to crank out an obj file for the linker. Can't be a permissions issue, otherwise it would choke also when building as a project.
--
Duke

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Using code::blocks w/o a project
« Reply #44 on: January 29, 2024, 06:34:59 am »
My global compiler setting must be set correctly because it finally compiled the code under the project structure. However, for some reason it refused to crank out an obj file for the linker. Can't be a permissions issue, otherwise it would choke also when building as a project.

When *not* using a project, the single file operations needs to use an Compiler, it either uses "GCC" or the "DEFAULT" Compiler. The global compiler options is where the default compiler is set. There has been many of weird problem traced to the CB user having an different global Compiler than the person trying to help them. I do not think this is your problem; but, it has surprised me how many people over look the set as default option for hours while some tries to help them!

Tim S.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org