Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I am relatively new to building programs on linux and specifically the Maemo platform. I have pulled some code from a few different sources with the idea of building ...
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    2

    Help Compiling a Program

    Hi,

    I am relatively new to building programs on linux and specifically the Maemo platform.

    I have pulled some code from a few different sources with the idea of building a simple war driving application.

    I started with a simple template provided by ESbox (the IDE I am using, based on Eclipse) and added what I needed. However, once I worked out some of the errors, I try to build and I get the two following errors.


    helloworld_i18n-Wifi.o: In function `Wifi::HandleMessage(DBusConnection*, DBusMessage*)':/home/maemo/warDriver/src/Wifi.cpp undefined reference to `StrFunc::StringToWString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' warDriver line 175 C/C++ Problem

    helloworld_i18n-Wifi.o: In function `Wifi::SetPowerSaving(bool)':/home/maemo/warDriver/src/Wifi.cpp undefined reference to `Wifi::UpdateWifi()' warDriver line 394 C/C++ Problem

    Both of these functions have been defined and show no errors until I try to build.

    Any ideas on what to do to solve the issue?

    Thanks in advance for your help!

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    "undefined reference" is an error in the linking stage.
    You need to link the object files and libraries where the code is in.
    Debian GNU/Linux -- You know you want it.

  3. #3
    Just Joined!
    Join Date
    Nov 2009
    Posts
    2
    How do I go about doing this? I new to the whole idea of makefiles and the like (coming from Windows (C++ and C#) and compiling in VS)

    The file structure for the application is nothing fancy...everything is in the same top level folder.

    src/main.cpp
    src/Wifi.cpp
    src/Wifi.h
    src/Window.cpp
    src/Window.h
    src/StrFunc.cpp
    src/StrFunc.h

    Ideally, I'd like to have these in their own respective folders, but I was having issues until I just combined them all.

    Thanks!

  4. #4
    Just Joined! kb2tfa's Avatar
    Join Date
    Nov 2009
    Location
    Philadelphia PA
    Posts
    1
    not sure if this will help, but how are you putting them all together.

    for example if I have test.c and test2.c, and these are libraries ( no main() ) then
    I cc -c test.c test2.c

    the -c option prevents the compilter from trying to compile as a full program which would fail.

    then when I type ls, I find test.o and test2.o libraries to be included, I know this example is C and you're using C++. maybe it might help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...