Author Topic: Ubuntu 13.04, codeblocks would not compile.  (Read 21924 times)

Offline vasilenko93

  • Single posting newcomer
  • *
  • Posts: 8
Ubuntu 13.04, codeblocks would not compile.
« on: August 19, 2013, 02:32:52 am »
I have installed build-essential, gdb, ibwxgtk2.8-0, and codeblocks from software center with all the add-ons.

But get this when I make a new console program and just build the default Hello World.

rmollenkamp

  • Guest
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #1 on: August 19, 2013, 02:36:18 am »
I have this exact same problem.  I cannot get the program to compile

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #2 on: August 19, 2013, 06:10:06 am »
Dou you have g++ installed ?
I'm not sure it is a dependency of the build-essential package.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #3 on: August 19, 2013, 06:32:53 am »
Dou you have g++ installed ?
I'm not sure it is a dependency of the build-essential package.
I just checked it, it is indeed a dependency, so please post the full error message from the build log, not tthe build messages.
And please use cut and paste and not a screenshot and put the text in code-tags (reachable via the #-button in the forums editor).

Offline vasilenko93

  • Single posting newcomer
  • *
  • Posts: 8
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #4 on: August 19, 2013, 04:45:45 pm »
I went into Environment settings and tried changing "Shell to run commands with:" to /bin/bash. Here is the result after I clicked build.
Code: [Select]

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

g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programing/testProject/main.cpp -o obj/Debug/main.o
/bin/bash: g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/testProject/main.cpp -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))

Same thing happens with the default /bin/sh.
Code: [Select]

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

g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programing/testProject/main.cpp -o obj/Debug/main.o
/bin/sh: 0: Can't open g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/testProject/main.cpp -o obj/Debug/main.o
Process terminated with status 127 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I tried clicking both Debug and Release, with both shell programs. Still shows this error message.
« Last Edit: August 19, 2013, 05:10:42 pm by vasilenko93 »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #5 on: August 19, 2013, 04:57:52 pm »
What does g++ --version print on console ?
If it exists in path(I mean g++), can you try to run the command to compile your soucres from console ?

And of course: make sure you have read and write access to the project-folder and the subfolders.

Offline vasilenko93

  • Single posting newcomer
  • *
  • Posts: 8
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #6 on: August 19, 2013, 05:09:33 pm »
Code: [Select]
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Changed the permissions, now I have this.
/home/USER_NAME/Programming/testProject
the directory Programming and all of its sub-directories are with the permission rwxrwxrwx

Still has the same errors.
Code: [Select]
g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/GDFFDF/main.cpp -o obj/Debug/main.o
/bin/bash: g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/GDFFDF/main.cpp -o obj/Debug/main.o: No such file or directory
"GDFFDF", I quickly made a new console application. No change.
« Last Edit: August 19, 2013, 05:11:50 pm by vasilenko93 »

Offline cacb

  • Regular
  • ***
  • Posts: 426
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #7 on: August 19, 2013, 10:17:53 pm »
If you are dual-booting with Windows, it is a good idea to use a Linux-formatted (ext3 or ext4) partition. I've had similar strange issues when compiling on an NTFS partition from Linux.

Offline vasilenko93

  • Single posting newcomer
  • *
  • Posts: 8
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #8 on: August 19, 2013, 10:50:08 pm »
If you are dual-booting with Windows, it is a good idea to use a Linux-formatted (ext3 or ext4) partition. I've had similar strange issues when compiling on an NTFS partition from Linux.

My linux partition is ext4, and windows partition NTFS. And compiling is not the problem, I went into the folder that codeblocks created and compiled the Hell World program with g++ from terminal.
Code: [Select]
g++ -o program main.cppIt showed no errors, and I could run the program. Codeblocks could not for some reason do the same, even though the same compiler is used in both scenarios.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #9 on: August 19, 2013, 10:57:12 pm »
Please try it with the exact  same command from the projects root.
And check the user that owns the running C::B process, e.g by typing ps -eaf | grep codeblocks or by running the env command in the pre- or postbuild step of the project.

Offline Wyrm

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #10 on: August 20, 2013, 08:14:56 am »
I went into Environment settings and tried changing "Shell to run commands with:" to /bin/bash. Here is the result after I clicked build.
Code: [Select]

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

g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programing/testProject/main.cpp -o obj/Debug/main.o
/bin/bash: g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/testProject/main.cpp -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))

Same thing happens with the default /bin/sh.
Code: [Select]

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

g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programing/testProject/main.cpp -o obj/Debug/main.o
/bin/sh: 0: Can't open g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/testProject/main.cpp -o obj/Debug/main.o
Process terminated with status 127 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I tried clicking both Debug and Release, with both shell programs. Still shows this error message.

You see this message because path "obj/Debug/main.o" is invalid on Linux. You need to change your configuration to something like "./obj/Debug/main.o" or "/full/path/to/obj/Debug/main.o".

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #11 on: August 20, 2013, 10:26:54 am »
I went into Environment settings and tried changing "Shell to run commands with:" to /bin/bash. Here is the result after I clicked build.
Code: [Select]

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

g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programing/testProject/main.cpp -o obj/Debug/main.o
/bin/bash: g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/testProject/main.cpp -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))

Same thing happens with the default /bin/sh.
Code: [Select]

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

g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programing/testProject/main.cpp -o obj/Debug/main.o
/bin/sh: 0: Can't open g++ -Wall -fexceptions -g  -c /home/USER_NAME/Programming/testProject/main.cpp -o obj/Debug/main.o
Process terminated with status 127 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I tried clicking both Debug and Release, with both shell programs. Still shows this error message.

You see this message because path "obj/Debug/main.o" is invalid on Linux. You need to change your configuration to something like "./obj/Debug/main.o" or "/full/path/to/obj/Debug/main.o".

Sorry to say. but this is absolutely bullshit !!

What you mean is, that you have to prepend ./ to run executables from inside the folder they reside in.
This is not needed for the output or the input. Try e.g. redirecting with < or >.
This is also not needed if the exe is in a subfolder, in this case [relative_path_to_folder/[exe] is enough.
By the way. the single dot is just the relative path to the actual subfolder, so no difference to my last exampl.

Offline Wyrm

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #12 on: August 20, 2013, 04:45:48 pm »
Jens, you are right you can use it.

That said, I am still reasonably sure that in his case either (a) his current working directory is wrong or (b) Debug directory doesn't exists before he calls it. Directories Debug or Release may not exist if he deletes them on "make clean". Current working directory may be wrong if he calls it from another script or chain of scripts/tools.

If my conjecture is correct, please right click on the project -> Properties -> Select "Build targets" tab. On this tab, for both debug and release targets change "Objects output dir.:" to "./" and "Execution working dir.:" to "./". Remember to do it for both targets or at least for the one that you intend to test. Save settings and try compiling again. I know Jens will probably object but I'd encourage you to give it a try.
« Last Edit: August 20, 2013, 05:26:55 pm by Wyrm »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #13 on: August 20, 2013, 06:29:26 pm »
Don't do that or you get debug and release object files mixed and this might or might not work.

Try the exact same command from exact same folder (projects root folder), if that works, check the user that C::B really runs as and make sure no non-ascii characters are in the path (not even in username) given to the compiler or all discussion here is just a waste of time.

Offline vasilenko93

  • Single posting newcomer
  • *
  • Posts: 8
Re: Ubuntu 13.04, codeblocks would not compile.
« Reply #14 on: August 20, 2013, 09:56:58 pm »
Don't do that or you get debug and release object files mixed and this might or might not work.

Try the exact same command from exact same folder (projects root folder), if that works, check the user that C::B really runs as and make sure no non-ascii characters are in the path (not even in username) given to the compiler or all discussion here is just a waste of time.

Running the same command from terminal gives no errors. And when it comes to the user that runs codeblocks, its me I think.