---------- Forwarded message ---------- From: ankit jain <ankitgu...@gmail.com> Date: 2009/5/15 Subject: Re: [CMake] unable to include a source file for all sub directories To: Hendrik Sattler <p...@hendrik-sattler.de>
2009/5/15 Hendrik Sattler <p...@hendrik-sattler.de> > Zitat von ankit jain <ankitgu...@gmail.com>: > >> Now all files iam getting from folder1 and folder2 and objects of all >> files >> including Ident.c is created... But while linking f11.obj f12.obj f21.obj >> f22.obj all show error undefined symbol: >> char *v1 >> >> where Ident .c contains.. >> >> char v1[]="Hello"; >> > > If you want a pointer, declare a pointer, not an array! > If you would use a common header file that is also used in Indent.c(!), you > would get something like (I don't have MSVC at hand but it's also a C++ > compiler): > $ cat a.c > extern char *v1; > char v1[] = "Hallo"; > > $ g++ -c -o a.o a.c > a.c:3: error: conflicting types for `char v1[]' > a.c:1: error: previous declaration as `char*v1' > > while: > $ cat a.c > extern char *v1; > char *v1 = "Hallo"; > > $ g++ -c -o a.o a.c > <no errors> > > HS > > But if it is a pointer problem only then why ity works if i include the same file in the subfolders which need that file. Also i have tried this thing it doesnot make any difference in building with VC++.
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake