[CMake] unable to include a source file for all sub directories

ankit jain ankitguddu at gmail.com
Fri May 15 08:00:21 EDT 2009


---------- Forwarded message ----------
From: ankit jain <ankitguddu at gmail.com>
Date: 2009/5/15
Subject: Re: [CMake] unable to include a source file for all sub directories
To: Hendrik Sattler <post at hendrik-sattler.de>




2009/5/15 Hendrik Sattler <post at hendrik-sattler.de>

> Zitat von ankit jain <ankitguddu at 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++.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090515/3d5ffa27/attachment.htm>


More information about the CMake mailing list