[Scons-users] Small troubles while trying simple scons build for my project
Steven Truppe
steven.truppe at chello.at
Sun Sep 18 02:09:26 EDT 2016
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
Strange, i tried it the way around env['LIB'] = and env['LIBPATH'] and
that doesn't worked :)
>
> On Sat, Sep 17, 2016 at 10:10 PM, Steven Truppe
> <steven.truppe at chello.at <mailto: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 list
>>> Scons-users at scons.org <mailto:Scons-users at scons.org>
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> <https://pairlist4.pair.net/mailman/listinfo/scons-users>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org <mailto:Scons-users at scons.org>
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> <https://pairlist4.pair.net/mailman/listinfo/scons-users>
> _______________________________________________ Scons-users
> mailing list Scons-users at scons.org <mailto:Scons-users at scons.org>
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://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/20160918/c8a4c37d/attachment.html>
More information about the Scons-users
mailing list