Thanks Ben, you've solved my first problem. It's a bit tricky ;)

Concerning my second problem, in fact, Tools.cpp has it's own header,
Tools.h, which contains
all functions prototyping. But if I include the header, Tools.h, in Main.cpp
and build the project
here's one of the error messages I get :

Main.mcp, Target: Release
Link Error   : Main.cpp: 'GetNbGPSMessages()' referenced from
'AppEventLoop()' is undefined.

The fact that Tools.h and Tools.cpp are found in a different directory
(common directory shared
with other projects), can it be the problem. There's no Tools.mcp in that
directory, only Tools.h
and Tools.cpp. During the project building, Tools.cpp is compiled without
error.

In the project windows :
        Main.mcp -> Source folder : Tools.cpp, MathLib.c, Main.cpp


Thanks again Ben,

Cordialement,
Agus Silas
BST Technologies
T. (+33) 5 57 80 16 03
F. (+33) 5 57 77 29 97
http://www.bst-technologies.com
44° 52' 55.70 N - 0° 31' 54.19 W
********************************************
********************************************

-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]De la part de Ben
Combee
Envoyé : mardi 10 décembre 2002 18:01
À : Palm Developer Forum
Objet : Re: Project building error


At 16:19 2002-12-10 +0100, you wrote:
>I've just noticed that CodeWarrior 8.3 won't build my project which
contains
>2 .cpp files and MathLib.c file. All files are declared in the project and
I
>use only one segment. In the main.cpp, I call "pow" and "sqrt" functions
>from the MathLib.c. Both MathLib.h and MathLib.c were added automatically
>when creating the project.
>
>I got a "Link error : pow (sqrt) referenced from main.cpp is not defined".

This doesn't exactly look like the error message I'd expect... in CW, you
can copy error messages to the clipboard by highlighting one of them, and
then using Edit/Copy.

Looking closer at MathLib.h, I see the problem.  This header file doesn't
have the proper guards for inclusion in a C++ program.  You can get around
this by saying:

extern "C" {
     #include "MathLib.h"
}

That will tell C++ that the functions declared by MathLib.h are from a .c
source file, and will allow you to link your C++ code to the MathLib C code.

>The second .cpp file, Tools.cpp, contains some shared functions. I do have
>to add "#include "Tools.cpp" in the Main.cpp so that the builder can find
>the functions' definitions, otherwise I will get the same error.

Another problem -- you don't include other .cpp files, you add them to your
project, and you make a common .h file that declares prototypes for the
exported functions.

>I've tried to look in the samples which using multiple files, comparing the
>configuration, but I cannot find the difference. I can build successfully
>the samples.


--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com


--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to