Recent Posts

Pages: 1 ... 5 6 7 8 9 [10]
91
General (but related to Code::Blocks) / Re: Problem opening file
« Last post by Miguel Gimenez on August 11, 2017, 02:12:39 pm »
The default directory is usually different in both environments, within CB the directory is "." (where the CBP file resides) and in a terminal it is where you set it (usually the executable directory). So, depending where the txt file is, the executabe finds it or not.

To correct this in Project -> Properties -> Build targets the output filename dir and the execution working dir should be the same.
92
General (but related to Code::Blocks) / Problem opening file
« Last post by ordak on August 11, 2017, 11:54:01 am »
Hi,

When I run the following code from Code::Blocks it runs as expected, however if I run it from Terminal in Ubuntu it fails. What can I do?

The code taken from Internet with some modification:

Code: [Select]
// Template Hello World 4

#include <stdio.h>
#include <stdlib.h>

void simple_err(const char *const str)
{
    fprintf(stderr,"%s\n",str);
    exit (EXIT_FAILURE);
}

int main (void)
{
    FILE *fp;
    fp = fopen ("input_file.text","r");
    if (fp == NULL)
        simple_err("Problem opening file.");

    fclose (fp);
    printf ("File opened okay\n");

    return EXIT_SUCCESS;
}
93
General (but related to Code::Blocks) / Re: exe extension on Ubuntu
« Last post by jens on August 11, 2017, 11:45:14 am »
Quote
-o bin/Release/THW4
You haven't changed the right one, looks like...


In Project/properties/Build targets I added "Copy of release" and made the changes.  Later I re-ordered it to the top. It did not became default as I expected. Now making the changes to "Release" build target does the job.
Good to see it's working now.
94
General (but related to Code::Blocks) / Re: exe extension on Ubuntu
« Last post by Commaster on August 11, 2017, 11:09:29 am »
There's no "default" target, you always select the target in a DropDownList on the toolbar above.
95
General (but related to Code::Blocks) / Re: exe extension on Ubuntu
« Last post by ordak on August 11, 2017, 10:50:35 am »
Quote
-o bin/Release/THW4
You haven't changed the right one, looks like...


In Project/properties/Build targets I added "Copy of release" and made the changes.  Later I re-ordered it to the top. It did not became default as I expected. Now making the changes to "Release" build target does the job.
96
Help / Re: I can't use the compiler for the C++
« Last post by Commaster on August 11, 2017, 10:16:09 am »
Please read the message again, UNDERSTAND IT and do what it tells you to do.
97
General (but related to Code::Blocks) / Re: exe extension on Ubuntu
« Last post by Commaster on August 11, 2017, 10:14:50 am »
Quote
-o bin/Release/THW4
You haven't changed the right one, looks like...
98
General (but related to Code::Blocks) / Re: exe extension on Ubuntu
« Last post by ordak on August 11, 2017, 10:05:03 am »
You have to disable "Auto generate filename extension" option in the Project -> Properties dialog.

I disabled it and changed "output filename" adding exe extension. But the compiled console application is still without extension.
I tested it here on Fedora with latest nightly and it works as expected.
Code: [Select]
-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g  -I/tmp/test -c /tmp/test/main.cpp -o obj/Debug/main.o
g++  -o bin/Debug/test.exe obj/Debug/main.o   
Output file is bin/Debug/test.exe with size 27,85 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 test (compiler: GNU GCC Compiler)---------------

Checking for existence: /tmp/test/bin/Debug/test.exe
Executing: gnome-terminal --hide-menubar -t test -x /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /tmp/test/bin/Debug/test.exe  (in /tmp/test/.)
Process terminated with status 0 (0 minute(s), 0 second(s))

Did you change it for all targets and if not, did you test it on the correct target ?

I used it on one target.

Quote
Can you copy the "Build log"when doing a full  rebuild and paset it here, at least the relevant part (linking of the executable) ?
You should see the full filename in the linker command in the logs.

Code: [Select]
-------------- Build: Release in THW4 (compiler: My_Copy of LLVM Clang Compiler)---------------

clang   -pedantic -Weverything -Wall -std=c11 -m64    -c /home/mehdi/Documents/Code_Blocks_Projects/Template_HW4/Main.c -o obj/Release/Main.o
clang++  -o bin/Release/THW4 obj/Release/Main.o  -m64 -static -lfftw3l  -lcunit
Output file is bin/Release/THW4 with size 891.45 KB
Process terminated with status 0 (0 minute(s), 2 second(s))
0 error(s), 0 warning(s) (0 minute(s), 2 second(s))
 

-------------- Run: Release in THW4 (compiler: My_Copy of LLVM Clang Compiler)---------------

Checking for existence: /home/mehdi/Documents/Code_Blocks_Projects/Template_HW4/bin/Release/THW4
Executing: gnome-terminal -t THW4 -x  /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/mehdi/Documents/Code_Blocks_Projects/Template_HW4/bin/Release/THW4  (in /home/mehdi/Documents/Code_Blocks_Projects/Template_HW4/bin/Release)
Process terminated with status 0 (0 minute(s), 0 second(s))
 

Quote
And to avoid any misunderstandings: you use a "real" Code::Blocks project, not a Makefile-based project ?

I used a User template.
99
Help / Re: I can't use the compiler for the C++
« Last post by doltawan on August 11, 2017, 09:41:31 am »
One more picture
100
Help / I can't use the compiler for the C++
« Last post by doltawan on August 11, 2017, 09:40:27 am »
I downloaded CB with the mingw on my Windows 7 Professional 32-bit PC, but I keep getting this error message.


"Tawan - Debug": The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.
Probably the toolchain path within the compiler options is not setup correctly?! (Do you have a compiler installed?)
Goto "Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables" and fix the compiler's setup.
Skipping...
Nothing to be done (all items are up-to-date).
Pages: 1 ... 5 6 7 8 9 [10]