I having a linker error problem that I have not been able to solve.
I have a custom library file I make using one file called symbol_table.cpp.
I build the project and everything seems fine.
I have another project that need the custom library to be linked together with the other code it uses. The problem happens when I link the custom library file with this code. I get the following linker errors (4 total):
symbol_table.o */QNX630/target/qnx6/x86/libSymbol.a(symbol_table.o): In function load_any_parameters(char \*, ini_entry_def \*)': undefined reference to
PxConfigGetCx(void)’
symbol_table.o */QNX630/target/qnx6/x86/libSymbol.a(symbol_table.o): In function save_any_parameters(char \*, ini_entry_def \*)': undefined reference to
PxConfigGetCx(void)’
symbol_table.o * undefined reference to PxConfigGetCx(void)' undefined reference to
PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)’
symbol_table.o * undefined reference to PxConfigGetCx(void)' undefined reference to
PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)’
in the custom library file I link in the following libraries.
LIBS+=ph phexlib phrtlib
In the other project, I use the following libraries:
LIBS+=c m socket bessel -Bstatic Symbol -Bdynamic
Any ideas?
noc
July 18, 2005, 6:55pm
2
In your other project, try to add those Photon libs (as you used in the custom library file).
The libs you added in the custom lib project are useless - because libs are not linked into libs.
You will have to add the extra libs to your application project, as NOC pointed out.
I tried to add the extra libs to my application project as NOC pointed out without any luck. Here is the line from common.mk
LIBS+=c m socket bessel phexlib ph -Bstatic Process Symbol -Bdynamic
Any other ideas or hints to try?
Thanks in advance.
The GNU linker is a one-pass linker. You need to order your libs so that the dependencies run from left to right. This may include
having to add a lib to the link line twice.
Note that you should never need to add libc to your libs, since it is included last by default.
Try something like…
LIBS+=-Bstatic Process Symbol -Bdynamic bessel phexlib ph socket m
I tried your suggestion below with no luck
LIBS+=-Bstatic Process Symbol -Bdynamic bessel phexlib ph socket m
I also tried to change around the order with no luck.
Is there a problem if I am not using in a Photon environment?
Do it by a process of elimination.
Start off with just
LIBS += -Bstatic Process Symbol -Bdynamic
and then check the first set of unresolved. Add the lib that has them.
Then link again and check the first unresolveds, adding the next lib, and so on. You will eventually come up with the right link order.
I started with your suggestion and got a 2 errors stating undefined reference to fp_precision. Along with the 4 original linker errors. So I made the LIBS line look like this:
LIBS += m -Bstatic Process Symbol -Bdynamic
and the 2 new error messages where gone. Leaving just the original 4. So I added phexlib.
I got the same 4 linker errors. But I looked under the C-Build tab instead of the Task tab and saw the following errors:
C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to wctoutf8' C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to
PtTerminalDefaultCharsets’
C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to PtSetResources' C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to
utf8towc’
C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to PtSpawn' C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to
PtConnectionFindName’
C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to PtConnectionSend' C:/QNX630/target/qnx6/x86/usr/lib/libphexlib.so: undefined reference to
PiDuplicateImage’
So I added ph into the LIB line and they went away. I tried ph and phexlib in the following orders:
LIBS+=ph phexlib m -Bstatic Process Symbol -Bdynamic
LIBS+=phexlib ph m -Bstatic Process Symbol -Bdynamic
LIBS+=m -Bstatic Process Symbol -Bdynamic ph phexlib
LIBS+=m -Bstatic Process Symbol -Bdynamic phexlib ph
But what I think is funny that I got the same linker error with or without ph & phexlib linked in.
Any ideas?
Unresolved symbols are resolved from left to right.
Take for example,
a.o - requires function_one() (which isn’t in a.o)
libfoo.a - supplies function_one(), requires function_two()
libbar.a - supplies function_two()
now if you added them in the following order
LIBS += foo bar
then it would work, but
LIBS += bar foo
it would not. Why?
Because a.o doesn’t need anything from libbar.a, although it does need function_o
Now the linker pulles in the object from libfoo.a but it has an unresolved reference
to function_two()
However since the GNU linker is one pass then it cannot go back to libbar.a
The following WOULD work
LIBS += bar foo bar
Can you please post the entire output of the link (including the qcc line) from your build console.
Here is the whole build like you requested. Thanks in advance for your help.
make -k PROJECT_ROOT_Process=C:/QNX630/workspace/Process PROJECT_ROOT_Symbol=C:/QNX630/workspace/Symbol EXTRA_SUFFIXES=cpp clean all
make -j 1 -Cx86 -fMakefile clean
make[1]: Entering directory C:/QNX630/workspace/datalog/x86' make -j 1 -Co -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o’
C:/QNX630/host/win32/x86/usr/bin/rm -f datalog *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o' make -j 1 -Co-g -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o-g’
C:/QNX630/host/win32/x86/usr/bin/rm -f datalog_g *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o-g' make[1]: Leaving directory
C:/QNX630/workspace/datalog/x86’
make -j 1 -Cx86 -fMakefile all
make[1]: Entering directory C:/QNX630/workspace/datalog/x86' make -j 1 -Co -fMakefile all make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include C:/QNX630/workspace/datalog/WriteCircleQ.cpp
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include C:/QNX630/workspace/datalog/datalog.cpp
C:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/datalog/x86/o/datalog
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -lang-c++ -M -oC:/QNX630/workspace/datalog/x86/o/datalog WriteCircleQ.o datalog.o -L. -LC:/QNX630/target/qnx6/x86/ -LC:/QNX630/target/qnx6/x86/lib -LC:/QNX630/target/qnx6/x86/usr/lib -lph -lphexlib -lph -lm -Bstatic -lProcess -lSymbol -Bdynamic
C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function load_any_parameters(char *, ini_entry_def *)': symbol_table.o(.text+0x2eb9): undefined reference to
PxConfigGetCx(void)’
symbol_table.o(.text+0x2ebf): undefined reference to PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)' C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function
save_any_parameters(char *, ini_entry_def *)’:
symbol_table.o(.text+0x2f7f): undefined reference to PxConfigGetCx(void)' symbol_table.o(.text+0x2f85): undefined reference to
PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)’
cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1
make[2]: *** [C:/QNX630/workspace/datalog/x86/o/datalog] Error 1
make[2]: Target all' not remade because of errors. make[1]: [all] Error 2 (ignored) make[2]: Leaving directory
C:/QNX630/workspace/datalog/x86/o’
make -j 1 -Co-g -fMakefile all
make[2]: Entering directory C:/QNX630/workspace/datalog/x86/o-g' C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86/o-g -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_g C:/QNX630/workspace/datalog/WriteCircleQ.cpp C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86/o-g -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_g C:/QNX630/workspace/datalog/datalog.cpp C:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/datalog/x86/o-g/datalog_g C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -lang-c++ -M -oC:/QNX630/workspace/datalog/x86/o-g/datalog_g WriteCircleQ.o datalog.o -L. -LC:/QNX630/target/qnx6/x86/ -LC:/QNX630/target/qnx6/x86/lib -LC:/QNX630/target/qnx6/x86/usr/lib -lph -lphexlib -lph -lm -Bstatic -lProcess -lSymbol -Bdynamic -g C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function
load_any_parameters(char *, ini_entry_def *)’:
symbol_table.o(.text+0x2eb9): undefined reference to PxConfigGetCx(void)' symbol_table.o(.text+0x2ebf): undefined reference to
PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)’
C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function save_any_parameters(char *, ini_entry_def *)': symbol_table.o(.text+0x2f7f): undefined reference to
PxConfigGetCx(void)’
symbol_table.o(.text+0x2f85): undefined reference to PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)' cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1 make[2]: *** [C:/QNX630/workspace/datalog/x86/o-g/datalog_g] Error 1 make[2]: Target
all’ not remade because of errors.
make[1]: [all] Error 2 (ignored)
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o-g' make[1]: Leaving directory
C:/QNX630/workspace/datalog/x86’
Now put phexlib and ph AFTER Symbol, and post the same. As far as I can see, that should fix it.
Sorry, tried your suggestion with the following result:
make -k PROJECT_ROOT_Process=C:/QNX630/workspace/Process PROJECT_ROOT_Symbol=C:/QNX630/workspace/Symbol EXTRA_SUFFIXES=cpp clean all
make -j 1 -Cx86 -fMakefile clean
make[1]: Entering directory C:/QNX630/workspace/datalog/x86' make -j 1 -Co -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o’
C:/QNX630/host/win32/x86/usr/bin/rm -f datalog *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o' make -j 1 -Co-g -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o-g’
C:/QNX630/host/win32/x86/usr/bin/rm -f datalog_g *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o-g' make[1]: Leaving directory
C:/QNX630/workspace/datalog/x86’
make -j 1 -Cx86 -fMakefile all
make[1]: Entering directory C:/QNX630/workspace/datalog/x86' make -j 1 -Co -fMakefile all make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include C:/QNX630/workspace/datalog/WriteCircleQ.cpp
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include C:/QNX630/workspace/datalog/datalog.cpp
C:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/datalog/x86/o/datalog
C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function load_any_parameters(char *, ini_entry_def *)': symbol_table.o(.text+0x2eb9): undefined reference to
PxConfigGetCx(void)’
symbol_table.o(.text+0x2ebf): undefined reference to PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)' C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function
save_any_parameters(char *, ini_entry_def *)’:
symbol_table.o(.text+0x2f7f): undefined reference to PxConfigGetCx(void)' symbol_table.o(.text+0x2f85): undefined reference to
PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -lang-c++ -M -oC:/QNX630/workspace/datalog/x86/o/datalog WriteCircleQ.o datalog.o -L. -LC:/QNX630/target/qnx6/x86/ -LC:/QNX630/target/qnx6/x86/lib -LC:/QNX630/target/qnx6/x86/usr/lib -lm -Bstatic -lProcess -lSymbol -lph -lphexlib -Bdynamic
cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1
make[2]: *** [C:/QNX630/workspace/datalog/x86/o/datalog] Error 1
make[2]: Target all' not remade because of errors. make[1]: [all] Error 2 (ignored) make[2]: Leaving directory
C:/QNX630/workspace/datalog/x86/o’
make -j 1 -Co-g -fMakefile all
make[2]: Entering directory C:/QNX630/workspace/datalog/x86/o-g' C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86/o-g -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_g C:/QNX630/workspace/datalog/WriteCircleQ.cpp C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86/o-g -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_g C:/QNX630/workspace/datalog/datalog.cpp C:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/datalog/x86/o-g/datalog_g C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -lang-c++ -M -oC:/QNX630/workspace/datalog/x86/o-g/datalog_g WriteCircleQ.o datalog.o -L. -LC:/QNX630/target/qnx6/x86/ -LC:/QNX630/target/qnx6/x86/lib -LC:/QNX630/target/qnx6/x86/usr/lib -lm -Bstatic -lProcess -lSymbol -lph -lphexlib -Bdynamic -g C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function
load_any_parameters(char *, ini_entry_def *)’:
symbol_table.o(.text+0x2eb9): undefined reference to PxConfigGetCx(void)' symbol_table.o(.text+0x2ebf): undefined reference to
PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)’
C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function save_any_parameters(char *, ini_entry_def *)': symbol_table.o(.text+0x2f7f): undefined reference to
PxConfigGetCx(void)’
symbol_table.o(.text+0x2f85): undefined reference to PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)' cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1 make[2]: *** [C:/QNX630/workspace/datalog/x86/o-g/datalog_g] Error 1 make[2]: Target
all’ not remade because of errors.
make[1]: [all] Error 2 (ignored)
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o-g' make[1]: Leaving directory
C:/QNX630/workspace/datalog/x86’
The -lph and -lphexlib need to be AFTER the -Bdynamic
Did not make a difference.
Here is the C-Build
make -k PROJECT_ROOT_Process=C:/QNX630/workspace/Process PROJECT_ROOT_Symbol=C:/QNX630/workspace/Symbol EXTRA_SUFFIXES=cpp clean all
make -j 1 -Cx86 -fMakefile clean
make[1]: Entering directory C:/QNX630/workspace/datalog/x86' make -j 1 -Co -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o’
C:/QNX630/host/win32/x86/usr/bin/rm -f datalog *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o' make -j 1 -Co-g -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o-g’
C:/QNX630/host/win32/x86/usr/bin/rm -f datalog_g *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o-g' make[1]: Leaving directory
C:/QNX630/workspace/datalog/x86’
make -j 1 -Cx86 -fMakefile all
make[1]: Entering directory C:/QNX630/workspace/datalog/x86' make -j 1 -Co -fMakefile all make[2]: Entering directory
C:/QNX630/workspace/datalog/x86/o’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include C:/QNX630/workspace/datalog/WriteCircleQ.cpp
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include C:/QNX630/workspace/datalog/datalog.cpp
C:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/datalog/x86/o/datalog
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -lang-c++ -M -oC:/QNX630/workspace/datalog/x86/o/datalog WriteCircleQ.o datalog.o -L. -LC:/QNX630/target/qnx6/x86/ -LC:/QNX630/target/qnx6/x86/lib -LC:/QNX630/target/qnx6/x86/usr/lib -lm -Bstatic -lProcess -lSymbol -Bdynamic -lphexlib -lph
C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function load_any_parameters(char *, ini_entry_def *)': symbol_table.o(.text+0x2eb9): undefined reference to
PxConfigGetCx(void)’
symbol_table.o(.text+0x2ebf): undefined reference to PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)' C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function
save_any_parameters(char *, ini_entry_def *)’:
symbol_table.o(.text+0x2f7f): undefined reference to PxConfigGetCx(void)' symbol_table.o(.text+0x2f85): undefined reference to
PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)’
cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1
make[2]: *** [C:/QNX630/workspace/datalog/x86/o/datalog] Error 1
make[2]: Target all' not remade because of errors. make[1]: [all] Error 2 (ignored) make[2]: Leaving directory
C:/QNX630/workspace/datalog/x86/o’
make -j 1 -Co-g -fMakefile all
make[2]: Entering directory C:/QNX630/workspace/datalog/x86/o-g' C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86/o-g -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_g C:/QNX630/workspace/datalog/WriteCircleQ.cpp C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/datalog/x86/o -IC:/QNX630/workspace/datalog/x86/o-g -IC:/QNX630/workspace/datalog/x86 -IC:/QNX630/workspace/datalog -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_g C:/QNX630/workspace/datalog/datalog.cpp C:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/datalog/x86/o-g/datalog_g C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -lang-c++ -M -oC:/QNX630/workspace/datalog/x86/o-g/datalog_g WriteCircleQ.o datalog.o -L. -LC:/QNX630/target/qnx6/x86/ -LC:/QNX630/target/qnx6/x86/lib -LC:/QNX630/target/qnx6/x86/usr/lib -lm -Bstatic -lProcess -lSymbol -Bdynamic -lphexlib -lph -g C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function
load_any_parameters(char *, ini_entry_def *)’:
symbol_table.o(.text+0x2eb9): undefined reference to PxConfigGetCx(void)' symbol_table.o(.text+0x2ebf): undefined reference to
PxConfigReadStringCx(px_cfg_context *, char const *, char const *, char const *, char *, unsigned int)’
C:/QNX630/target/qnx6/x86//libSymbol.a(symbol_table.o): In function save_any_parameters(char *, ini_entry_def *)': symbol_table.o(.text+0x2f7f): undefined reference to
PxConfigGetCx(void)’
symbol_table.o(.text+0x2f85): undefined reference to PxConfigWriteStringCx(px_cfg_context *, char const *, char const *, int, char const *)' cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1 make[2]: *** [C:/QNX630/workspace/datalog/x86/o-g/datalog_g] Error 1 make[2]: Target
all’ not remade because of errors.
make[1]: [all] Error 2 (ignored)
make[2]: Leaving directory C:/QNX630/workspace/datalog/x86/o-g' make[1]: Leaving directory
C:/QNX630/workspace/datalog/x86’
Ok I finally realized something - those functions ARE in libphexlib, but your code appears to have C++ mangled references to them. They are defined in photon/PxProto.h and are wrapped with
#ifdef __cplusplus
extern “C” {
#endif
so something is going wrong. What version of Momentics are you using again?
In any case, can you please post the output of compiling symbol_table.cpp and add
CCOPTS += -vv
to your Makefile.
You might also try adding -D__cplusplus=1 as a test, although that should NOT be necessary…
Thanks again for all your help
Here is my Momentics version
QNX® Momentics® Integrated Development Environment
Version: 2.2.0
Build id: 200405062055
Here is the build with CCOPTS += -vv
make -k EXTRA_SUFFIXES=cpp clean all
make -j 1 -Cx86 -fMakefile clean
make[1]: Entering directory C:/QNX630/workspace/Symbol/x86' make -j 1 -Ca -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/Symbol/x86/a’
C:/QNX630/host/win32/x86/usr/bin/rm -f libSymbol.a *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/Symbol/x86/a' make -j 1 -Ca-g -fMakefile clean make[2]: Entering directory
C:/QNX630/workspace/Symbol/x86/a-g’
C:/QNX630/host/win32/x86/usr/bin/rm -f libSymbol_g.a *.pinfo *.o *.err *.map mapfile *.sym *.i
make[2]: Leaving directory C:/QNX630/workspace/Symbol/x86/a-g' make[1]: Leaving directory
C:/QNX630/workspace/Symbol/x86’
make -j 1 -Cx86 -fMakefile all
make[1]: Entering directory C:/QNX630/workspace/Symbol/x86' make -j 1 -Ca -fMakefile all GNU CPP version 2.95.3 (QNX/Neutrino) #include "..." search starts here: #include <...> search starts here: . C:/QNX630/workspace/Symbol/x86 C:/QNX630/workspace/Symbol C:/QNX630/workspace/include C:/QNX630/target/qnx6/usr/include C:/QNX630/target/qnx6/usr/include/cpp/c C:/QNX630/target/qnx6/usr/include/cpp C:/QNX630/target/qnx6/usr/include End of search list. The following default directories have been omitted from the search path: /cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/../../../../include/g++-3 /cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/include /cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/../../../../ntox86/sys-include /cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/../../../../ntox86/include End of omitted list. make[2]: Entering directory
C:/QNX630/workspace/Symbol/x86/a’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -O -DNDEBUG -I. -IC:/QNX630/workspace/Symbol/x86/a -IC:/QNX630/workspace/Symbol/x86 -IC:/QNX630/workspace/Symbol -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -DVARIANT_a -vv C:/QNX630/workspace/Symbol/symbol_table.cpp
cc: looking for gcc_ntox86 in C:/QNX630/host/win32/x86/etc/qcc/gcc/2.95.3/gcc_ntox86++.conf
cc: looking for gcc_ntox86 in C:/QNX630/host/win32/x86/etc/qcc/gcc/2.95.3/gcc_ntox86.conf
C:/QNX630/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/cpp0 -D__OPTIMIZE__ -DNDEBUG -I. -IC:/QNX630/workspace/Symbol/x86/a -IC:/QNX630/workspace/Symbol/x86 -IC:/QNX630/workspace/Symbol -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -DVARIANT_a -v -nostdinc -nostdinc++ -D__cplusplus -D__QNX__ -D__QNXNTO__ -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__GNUG__=2 -D__unix__ -D__unix -D__ELF__ -D__X86__ -D__i386__ -D__LITTLEENDIAN__ -Acpu(386) -Acpu(i386) -Amachine(i386) -Asystem(unix) -Asystem(nto) -Asystem(qnx) -Asystem(qnxnto) -idirafter C:/QNX630/target/qnx6/usr/include -isystem C:/QNX630/target/qnx6/usr/include/cpp/c -isystem C:/QNX630/target/qnx6/usr/include/cpp -lang-c++ C:/QNX630/workspace/Symbol/symbol_table.cpp -o C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960\symbol_table.ii
C:/QNX630/host/win32/x86/usr/lib/gcc-libC:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/Symbol/x86/a/libSymbol.a
C:/QNX630/host/win32/x86/usr/bin/ntox86-ar -r C:/QNX630/workspace/Symbol/x86/a/libSymbol.a symbol_table.o
libSymbol.a → C:/QNX630/target/qnx6/x86/usr/lib/libSymbol.a
make[2]: Leaving directory C:/QNX630/workspace/Symbol/x86/a' make -j 1 -Ca-g -fMakefile all make[2]: Entering directory
C:/QNX630/workspace/Symbol/x86/a-g’
C:/QNX630/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -Wc,-Wno-parentheses -I. -IC:/QNX630/workspace/Symbol/x86/a -IC:/QNX630/workspace/Symbol/x86/a-g -IC:/QNX630/workspace/Symbol/x86 -IC:/QNX630/workspace/Symbol -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -g -DVARIANT_a -DVARIANT_g -vv C:/QNX630/workspace/Symbol/symbol_table.cpp
/ntox86/2.95.3/cc1plus -O1 -quiet -fno-builtin -fhonor-std -fcheck-new -Wall -Wno-parentheses C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960\symbol_table.ii -dumpbase C:/QNX630/workspace/Symbol/symbol_table.cpp -o C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960\symbol_table.s
C:/QNX630/host/win32/x86/usr/bin/ntox86-as C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960\symbol_table.s -o symbol_table.o
cc: unlinking C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960\symbol_table.ii
cc: unlinking C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960\symbol_table.s
cc: removing C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_5960
bash.exe: warning: could not find /tmp, please create!
GNU CPP version 2.95.3 (QNX/Neutrino)
#include “…” search starts here:
#include <…> search starts here:
.
C:/QNX630/workspace/Symbol/x86/a
C:/QNX630/workspace/Symbol/x86/a-g
C:/QNX630/workspace/Symbol/x86
C:/QNX630/workspace/Symbol
C:/QNX630/workspace/include
C:/QNX630/target/qnx6/usr/include
C:/QNX630/target/qnx6/usr/include/cpp/c
C:/QNX630/target/qnx6/usr/include/cpp
C:/QNX630/target/qnx6/usr/include
End of search list.
The following default directories have been omitted from the search path:
/cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/…/…/…/…/include/g+±3
/cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/include
/cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/…/…/…/…/ntox86/sys-include
/cygdrive/c/QNXsdk/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/…/…/…/…/ntox86/include
End of omitted list.
cc: looking for gcc_ntox86+debug in C:/QNX630/host/win32/x86/etc/qcc/gcc/2.95.3/gcc_ntox86++.conf
cc: looking for gcc_ntox86+debug in C:/QNX630/host/win32/x86/etc/qcc/gcc/2.95.3/gcc_ntox86.conf
C:/QNX630/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/cpp0 -I. -IC:/QNX630/workspace/Symbol/x86/a -IC:/QNX630/workspace/Symbol/x86/a-g -IC:/QNX630/workspace/Symbol/x86 -IC:/QNX630/workspace/Symbol -IC:/QNX630/workspace/include -IC:/QNX630/target/qnx6/usr/include -DVARIANT_a -DVARIANT_g -v -nostdinc -nostdinc++ -D__cplusplus -D__QNX__ -D__QNXNTO__ -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__GNUG__=2 -D__unix__ -D__unix -D__ELF__ -D__X86__ -D__i386__ -D__LITTLEENDIAN__ -Acpu(386) -Acpu(i386) -Amachine(i386) -Asystem(unix) -Asystem(nto) -Asystem(qnx) -Asystem(qnxnto) -idirafter C:/QNX630/target/qnx6/usr/include -isystem C:/QNX630/target/qnx6/usr/include/cpp/c -isystem C:/QNX630/target/qnx6/usr/include/cpp -lang-c++ C:/QNX630/workspace/Symbol/symbol_table.cpp -o C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_2988\symbol_table.ii
C:/QNX630/host/win32/x86/usr/lib/gcc-lib/ntox86/2.95.3/cc1plus -g2 -quiet -fno-builtin -fhonor-std -fcheck-new -Wall -Wno-parentheses C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_2988\symbol_table.ii -dumpbase C:/QNX630/workspace/Symbol/symbol_table.cpp -o C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_2988\symbol_table.s
C:/QNX630/host/win32/x86/usr/bin/ntox86-as C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_2988\symbol_table.s -o symbol_table.o
cc: unlinking C:\DOCUME~1\fswartz\LOCALS~1\TempC:/QNX630/host/win32/x86/usr/bin/rm -f C:/QNX630/workspace/Symbol/x86/a-g/libSymbol_g.a
C:/QNX630/host/win32/x86/usr/bin/ntox86-ar -r C:/QNX630/workspace/Symbol/x86/a-g/libSymbol_g.a symbol_table.o
libSymbol_g.a → C:/QNX630/target/qnx6/x86/usr/lib/libSymbol_g.a
make[2]: Leaving directory C:/QNX630/workspace/Symbol/x86/a-g' make[1]: Leaving directory
C:/QNX630/workspace/Symbol/x86’
\2_qcc_2988\symbol_table.ii
cc: unlinking C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_2988\symbol_table.s
cc: removing C:\DOCUME~1\fswartz\LOCALS~1\Temp\2_qcc_2988
bash.exe: warning: could not find /tmp, please create!
cburgess,
Well you made me realize something in your last posting. I am in the process of covert some QNX 4.25 compiled code to QNX 6.3 and I had commented out some of the following #ifdef in parts of my software.
#ifdef __cplusplus
extern “C” {
#endif
Then it hit me when you said that they are defined in photon/PxProto.h. So I double checked my file and found that I did same to that file. Well I removed the comments and rebuild mine project and no more linker errors.
Thanks for all of your help.
Glad to hear it resolved! :vD