[Scons-users] Small troubles while trying simple scons build for my project

William Blevins wblevins001 at gmail.com
Sat Sep 17 23:52:07 EDT 2016


Steven,

Did you look at the link to the User's Guide? That link should have taken
you specifically to the section about "Linking with Libraries".

V/R,
William


On Sat, Sep 17, 2016 at 11:41 PM, Steven Truppe <steven.truppe at chello.at>
wrote:

> I made the example as simple as possible, i hope someone can help me out
> here...
>
> On 2016-09-18 04:41, William Blevins wrote:
>
> Steven,
>
> It appears that the program "TestError" needs to be linked against the
> library "error". You forgot to set the linking flags LIBS and/or LIBPATH.
>
> http://scons.org/doc/production/HTML/scons-user.html#idp1396575996
>
> V/R,
> William
>
> On Sat, Sep 17, 2016 at 10:10 PM, Steven Truppe <steven.truppe at chello.at>
> wrote:
>
>>
>>
>> On 2016-09-18 03:52, Steven Truppe wrote:
>>
>>
>> On 2016-09-18 03:32, Steven Truppe wrote:
>>
>> Hi everyone, i've a small question and i solved it before but then stuck
>> again: here is my file structure:
>>
>> /bin
>> /docs
>> /src
>> /src/MainApp.c
>> /intern
>> /intern/Error/Error.h
>> /intern/Error/Error.c
>> /intern/Error/TestError.c
>> /intern/Error/SConscript
>> SConstruct
>>
>> It should be a very simple setup to create my build system for a larger
>> project i'm working on.
>>
>> the SConstruct file looks like this:
>>
>>
>> import os
>> env = Environment(
>>  ENV = os.environ,
>>  CPPPATH = "intern/"
>> )
>> Export("env")
>> env.SConscript(r'intern/Error/SConscript', variant_dir=r'#build/Error/',
>> duplicate=0)
>>
>>
>> And the SConscript file looks like:
>>
>> Import("env")
>> env.Library("error", "Error.c")
>> env.Program("TestError", ["TestError.c"])
>>
>>
>>
>> Error.h:
>>
>> #ifndef ERROR_HEADER
>> #define ERROR_HEADER
>>
>>
>> void err_hello(void);
>> void err_message(char *message);
>>
>>
>> #endif
>>
>>
>> Error.c:
>>
>> #include "Error.h"
>>
>> #include <stdio.h>
>>
>>
>> void err_hello(){
>>     printf("HEllO");
>> }
>>
>> void err_message(char *message) {
>>     printf("Error: '%s' in file %i on line %i in file %s", &message,
>> __LINE__, __FILE__, __func__);
>>
>>
>> And finaly the TestError.c file:
>>
>> #include "Error.h"
>>
>> int main(int argc, char **argv) {
>>     err_hello();
>>     err_message("This is an error message");
>>
>>     return(0);
>> }
>>
>>
>>
>>
>>
>>
>> So far so good, now my problem is that i get this error message when i
>> try to compile:
>>
>>
>> gcc -o build/Error/Error.o -c -Ibuild/Error/intern -Iintern/Error/intern
>> intern/Error/Error.c
>> gcc -o build/Error/TestError.o -c -Ibuild/Error/intern
>> -Iintern/Error/intern intern/Error/TestError.c
>> gcc -o build/Error/TestError build/Error/TestError.o
>> build/Error/TestError.o: In function `main':
>> TestError.c:(.text+0x10): undefined reference to `err_hello'
>> TestError.c:(.text+0x1a): undefined reference to `err_message'
>> collect2: error: ld returned 1 exit status
>> scons: *** [build/Error/TestError] Error 1
>>
>> I had the same issue when used a .cpp file in my project but that's now
>> only c so i have no clue... can someone look at the code and help me a
>> bit out here, it would would be a great help!
>>
>>
>> _______________________________________________
>> Scons-users mailing listScons-users at scons.orghttps://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>> _______________________________________________
>> Scons-users mailing listScons-users at scons.orghttps://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>> _______________________________________________ Scons-users mailing list
>> Scons-users at scons.org https://pairlist4.pair.net/mai
>> lman/listinfo/scons-users
>
> _______________________________________________
> Scons-users mailing listScons-users at scons.orghttps://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160917/97273032/attachment-0001.html>


More information about the Scons-users mailing list