User forums > Using Code::Blocks

Using code::blocks w/o a project

<< < (6/12) > >>

dukester:
~/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

Pecan:
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.
 

dukester:
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.

dukester:
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

Pecan:
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))

--- End code ---

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=

--- End code ---


[/code]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version