Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: srepuac on June 17, 2008, 01:49:39 pm
-
Hi all, I've installed code::blocks on my Ubuntu Desktop at work :), But for some reason, it gives me all kinds of weird errors when I try to compile a c++ file. C files on the other hand compile just fine.
My feeling is that I must be making a very stupid mistake, which is why I am not including the verbose, unless you think you need it.
Best Regards,
Srepuac :
:?
-
Umm, after experimenting a bit, it seems to happen only if I use the curses library, ansi c++ seems to compile fine.
The following simple program doesn't compile:
#include <ncurses.h>
int main()
{
initscr();
printw("%s", "hello world");
refresh();
endwin();
}
Codeblocks verboses the following:
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x833)||undefined reference to `dlopen'|
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x84d)||undefined reference to `dlsym'|
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x866)||undefined reference to `dlsym'|
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x87f)||undefined reference to `dlsym'|
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x898)||undefined reference to `dlsym'|
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x8b5)||undefined reference to `dlclose'|
||=== Build finished: 6 errors, 0 warnings ===|
-
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x833)||undefined reference to `dlopen'|
/usr/lib/libcurses.a(lib_mouse.o)||In function `_nc_mouse_init':|
(.text+0x84d)||undefined reference to `dlsym'|
[...]
http://www.google.com/search?q=undefined%20reference%20to%20%60dlopen'%7C
-
Umm, nice, but i can compile well with ubuntu's command line, my problem seems to be related to library linking in code::blocks or something. Anyone?
-
Post your project & build settings pls :)
EDIT: Also the successful command line build string may help.
-
srepuac, what problem, linking library to the project :)
-
Umm, project and build settings huh?
I'm not sure exactly how to check that, but I don't make projects, I just make File-New-File-C++ Source.
As for build settings, I just added the following libraries and search directories to my compiler:
Libraries:
libncurses++.a
libcurses.a
libncurses.a
libdl.a
libglib.a
Directories:
/usr/lib
Hope you can help me solve the problem, I love code::blocks :(
Oops, had forgotten the command line:
g++ file.cpp -o file -lncurses
-
Umm, project and build settings huh?
no :) Settings->Compiler and Debugger(Linker settings)
-
Well, McZim, on linker settings, I just have those extra libraries listed above
-
you need include this library /lib/libncurses.so.5
P.S.: path /lib, not /usr/lib. And shall be install this packages libncurses5, libncurses5-dev
-
I didn't find libncurses.so.5, just libncurses.so, which I added to the list.
libncurses5, libncurses5-dev are installed to the latest version :(
I also added the /lib dir, but still the same errors...
-
ok, if not find libncurses.so.5, include libncurses.so to the project, but path shall be /lib.
show me place result two command:
1. sudo aptitude search ncurses
2. sudo find / -name libncurses*
-
Hello McZim, thanks for the assistance :)
Here's the results of the two commands :
sudo aptitude search ncurses
p evms-ncurses - Enterprise Volume Management System (ncurs
p irmp3-ncurses - irmp3 control frontend
p lib64ncurses5 - Shared libraries for terminal handling (64
p lib64ncurses5-dev - Developer's libraries for ncurses (64-bit)
v libncurses-dev -
p libncurses-ruby - ruby Extension for the ncurses C library
p libncurses-ruby1.8 - ruby Extension for the ncurses C library
p libncurses-ruby1.9 - ruby Extension for the ncurses C library
p libncurses4 - Shared libraries for terminal handling
i libncurses5 - Shared libraries for terminal handling
p libncurses5-dbg - Debugging/profiling libraries for ncurses
i libncurses5-dev - Developer's libraries and docs for ncurses
i libncursesw5 - Shared libraries for terminal handling (wi
p libncursesw5-dbg - Debugging/profiling libraries for ncurses
p libncursesw5-dev - Developer's libraries for ncursesw
i ncurses-base - Descriptions of common terminal types
i ncurses-bin - Terminal-related programs and man pages
v ncurses-dev -
p ncurses-hexedit - Edit files/disks in hex, ASCII and EBCDIC
v ncurses-runtime -
p ncurses-term - Additional terminal type definitions
sudo find / -name libncurses*
/lib/libncursesw.so.5
/lib/libncurses.so.5
/lib/libncursesw.so.5.5
/lib/libncurses.so.5.5
/usr/lib/libncurses.so.5 /* I've now included them in the linker settings but I still get the same errors :( */
/usr/lib/libncurses.a
/usr/lib/vlc/gui/libncurses_plugin.so
/usr/lib/libncurses.so
/usr/lib/libncurses++.a
/usr/share/doc/libncurses5-dev
/usr/share/doc/libncurses5
/usr/share/doc/libncursesw5
/var/cache/apt/archives/libncurses5-dev_5.5-5ubuntu2_i386.deb
/var/cache/apt/archives/libncurses5_5.5-5ubuntu2_i386.deb
/var/lib/dpkg/info/libncursesw5.list
/var/lib/dpkg/info/libncursesw5.postrm
/var/lib/dpkg/info/libncurses5.shlibs
/var/lib/dpkg/info/libncurses5-dev.list
/var/lib/dpkg/info/libncurses5.list
/var/lib/dpkg/info/libncursesw5.shlibs
/var/lib/dpkg/info/libncurses5.postrm
/var/lib/dpkg/info/libncursesw5.postinst
/var/lib/dpkg/info/libncurses5.postinst
-
sudo aptitude search ncurses
i libncurses5 - Shared libraries for terminal handling
i libncurses5-dev - Developer's libraries and docs for ncurses
sudo find / -name libncurses*
/lib/libncurses.so.5
/usr/lib/libncurses.so.5 /* I've now included them in the linker settings but I still get the same errors :( */ << ERROR >>
Hi, thats ok, but you need include /lib/libncurses.so.5
and not /usr/lib/libncurses.so.5
-
Libraries
http://tinypic.com/view.php?pic=2vht0ro&s=3
Directories:
http://tinypic.com/view.php?pic=1z4yi5l&s=3
Anything wrong?
Libraries:
usr/lib/libncurses++.a
usr/lib/libcurses.a
usr/lib/libncurses.a
usr/lib/libdl.a
usr/lib/libglib.a
usr/lib/libncurses.so
/lib/libncurses.so.5
Directories:
lib
-
yes :) where is logic? include lib from /usr/lib and use dorectory /lib LOL:)
i'm use as described above, and work fine. If for you no true way :) so its you chose :)
-
THANKS MCZIM!!!
Though it was hard to understand what you meant, it works, I just removed every library apart from the libncurses.so.5 and I used the /lib directory only and it works perfectly, thanks for your time :)