Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Unable to Run or Debug code using GSL
Unable to Run or Debug code using GSL [message #1718873] Thu, 31 December 2015 08:16 Go to next message
Eclipse UserFriend
I'm trying to use GSL on Eclipse via Cygwin. I added the proper library (gls) and library search path (/usr/local/lib) in Cygwin C linker settings. The code below produces no output. If the line with gsl_matrix initialization is outcommented, the program works and I receive the output of the printf("Starting...\n") statement.

Quote:

#include <stdio.h>
#include <string.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_multifit.h>

int main (void)
{
printf("Starting...\n");
fflush(stdout);
int i, j, nr = 5, nc = 3;
gsl_matrix * A = gsl_matrix_calloc (nr, nc);
return 0;
}


There aren't any significant errors reported during the compilation. Only unused-variable errors exist.

Quote:

15:10:16 **** Build of configuration Debug for project ols ****
make all
Building file: ../ols.c
Invoking: Cygwin C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"ols.d" -MT"ols.d" -o "ols.o" "../ols.c"
../ols.c: In function 'main':
../ols.c:11:15: warning: unused variable 'A' [-Wunused-variable]
gsl_matrix * A = gsl_matrix_calloc (nr, nc);
^
../ols.c:10:9: warning: unused variable 'j' [-Wunused-variable]
int i, j, nr = 5, nc = 3;
^
../ols.c:10:6: warning: unused variable 'i' [-Wunused-variable]
int i, j, nr = 5, nc = 3;
^
Finished building: ../ols.c

Building target: ols.exe
Invoking: Cygwin C Linker
gcc -L/usr/local/lib -o "ols.exe" ./ols.o -lgsl
Finished building target: ols.exe

15:10:20 Build Finished (took 4s.671ms)


The program does not stop at breakpoints during the debug and produces the output below. Curiously, both the function "add" and the source code "ols2.c" belong to other projects without any link to the current one. The project with the "add" function is already deleted.

Quote:

The target endianness is set automatically (currently little endian)
Function "add" not defined.
No source file named C:\Users\sait\workspace\ols2\ols2.c.
No source file named C:\Users\sait\workspace\ols2\ols2.c.



Re: Unable to Run or Debug code using GSL [message #1718883 is a reply to message #1718873] Thu, 31 December 2015 13:54 Go to previous messageGo to next message
Eclipse UserFriend
I tried it under Linux and had no problems. That is, it worked as expected.

Did have to add libraries gslcblas and m to get it to link. Apparently, you don't need to.
You don't say where the messages appear. if it's the gdb log (which, for me, sometimes flashes before the program starts), then these are old debug points. For example:
index.php/fa/24459/0/
All of the red lines are debug points for other projects. You also may have values in .gdbinit that may be cleared. This is normal, not really an error, and shouldn't cause any problems.

It's possible that, when debugging, the Console view is stuck on the gdb debug console. Try clicking the down arrow that has the hover value "Display Selected Console" (next to the picture of a display) and select the one for the application. After that, make sure the icon with the hover value "Show console when standard output changes" is selected. It's not displayed in all windows so make sure you are looking at the app output console.

It's highlighted below. The console view select is the third to its right.
index.php/fa/24460/0/

[Updated on: Thu, 31 December 2015 13:56] by Moderator

Re: Unable to Run or Debug code using GSL [message #1718891 is a reply to message #1718883] Fri, 01 January 2016 03:04 Go to previous message
Eclipse UserFriend
Thanks for the point about old debug messages. Those really put me off the track.
I realized that when I executed the compiled file directly, Windows gives an error about a missing cygblas-0.dll which is probably suppressed under Eclipse. I added its location to the system path and everything works now.

Previous Topic:"Launch failed. Binary not found" with MINGW
Next Topic:Hitting breakpoint freezes UI in Ubuntu, requiring reboot
Goto Forum:
  


Current Time: Thu Nov 06 19:30:20 EST 2025

Powered by FUDForum. Page generated in 0.03641 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top