Help me to resolve undefined reference

Ku Cheng kucheng at cisco.com
Thu Mar 28 17:07:50 CST 2002


It does work, if it is a c program. However if I change it to C++ program, 
it does not link in my environment. I have attach the C++ version. Could 
you try it and let me know. If it works in your machine, it must have 
something to do with my environment.

Thanks for your help again.

Ku

************************** C++ program test.cpp ***********************
#include <winbase.h>

class A {
public:
          A(int a, double b);
private:
         int _a;
         double _b;
};
A::A(int a, double b) {
         _a = a;
         _b = b;
};
int main()
{
     A *mya=new A(2,5.6);
     DisconnectNamedPipe(NULL);
     //ConnectNamedPipe(NULL, NULL);
     return 0;
}

************* Execution in my environment **************

[root at wasabi2 winetest]# winemaker --lower-none --cuiexe -DSTRICT -I/usr/local/
include/wine .;
Winemaker 0.5.8
Copyright 2000 Francois Gouget <fgouget at codeweavers.com> for CodeWeavers
Scanning the source directories...
Fixing the source files...
   test.cpp
Generating project files...
   .
[root at wasabi2 winetest]# ./configure -with-wine=/usr/src/redhat/SOURCES/wine
loading cache ./config.cache
checking whether make sets ${MAKE}... (cached) yes
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for c++... (cached) c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... (cached) yes
checking whether c++ accepts -g... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking whether ln -s works... (cached) yes
checking for sqrt in -lm... (cached) yes
checking for iswalnum in -lw... (cached) no
checking for gethostbyname... (cached) yes
checking for connect... (cached) yes
checking for gcc strength-reduce bug... (cached) no
checking whether external symbols need an underscore prefix... (cached) no
checking whether we can build a Linux dll... (cached) yes
checking whether we need to define __i386__... (cached) no
checking for g++ -fpermissive option... yes
checking for g++ -fno-for-scope option... yes
checking for windef.h... (cached) /usr/src/redhat/SOURCES/wine/include
checking for windef.h header... (cached) /usr/src/redhat/SOURCES/wine/include
checking for libwine.so... (cached) /usr/src/redhat/SOURCES/wine
checking for -lwine... (cached) /usr/src/redhat/SOURCES/wine
checking for libntdll.so... (cached) /usr/src/redhat/SOURCES/wine/dlls
checking for -lntdll... (cached) /usr/src/redhat/SOURCES/wine/dlls
checking for wine... (cached) /usr/src/redhat/SOURCES/wine/wine
checking for winebuild... (cached) 
/usr/src/redhat/SOURCES/wine/tools/winebuild/
winebuild
checking for wrc... (cached) /usr/src/redhat/SOURCES/wine/tools/wrc/wrc
creating ./config.status
creating Make.rules
creating Makefile

Configure finished.  Do 'make' to build the project.

[root at wasabi2 winetest]# make
c++ -c -g -O2 -fpermissive -fno-for-scope  -D_REENTRANT -DWINELIB -DSTRICT 
-I. -
I/usr/local/include/wine -I/usr/src/redhat/SOURCES/wine/include -o test.o 
test.c
pp
test.cpp: In function `int main ()':
test.cpp:17: `DisconnectNamedPipe' undeclared (first use this function)
test.cpp:17: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [test.o] Error 1
[root at wasabi2 winetest]#



At 01:03 PM 3/28/2002 -0800, you wrote:
>I created a tiny example which calls
>DisconnectNamedPipe, added the function declaration to
>the header. I was able to successfully compile and
>link the example.
>Attaching the example and the patch. I'll submit the
>patch to CVS.
>
>Let me know if the example works for you after
>applying the patch.
>
>Andriy Palamarchuk
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Movies - coverage of the 74th Academy Awards®
>http://movies.yahoo.com/




More information about the wine-devel mailing list