Linking CPP .o Files to program.

DOS specific questions.
Dinosaur
Posts: 1339
Joined: Jul 24, 2005 1:13
Location: Hervey Bay
Contact:

Linking CPP .o Files to program.

Postby Dinosaur » Jun 08, 2014 17:06

Hi All

I have compiled a number of Cpp files into object files and put them in the folder to link with my FB program.
Then Compiled with FBDos and linking object files with the following statement.

Code: Select all

FbcDos -R -w pedantic -s console EduCake.bas -a wdigital.o -a io.o -a wanalog.o -a common.o -a mcm.o -x Educake.exe

Havent tried if only one -a is needed.

Then in my FB code declared the following to test one of the many functions in the object files.

Code: Select all

    Declare Sub PinMode Cdecl Alias "PinMode"(ByVal Pin As UInteger, ByVal Mode As UInteger)   
    Dim As UInteger Pin,Mode


And tried to call it as follows.

Code: Select all

    Pin = 13:Mode = 1
    PinMode (Pin,Mode)


I get a compile error

Code: Select all

EduCake.o:fake:(.text+0x689): undefined reference to `PinMode'
Build error(s)

The routine is defined in wdigital.cpp as
void pinMode(uint8_t pin, uint8_t mode)

I have no idea what I am doing wrong. Any suggestions welcome.
dkl
Site Admin
Posts: 3211
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Linking CPP .o Files to program.

Postby dkl » Jun 08, 2014 17:16

The names differ slightly: pinMode vs PinMode

By the way, you can just pass .o files to fbc as-is, no need for the -a <file> option. It's only useful for object files that don't have the .o extension.
Dinosaur
Posts: 1339
Joined: Jul 24, 2005 1:13
Location: Hervey Bay
Contact:

Re: Linking CPP .o Files to program.

Postby Dinosaur » Jun 08, 2014 17:37

Hi All

dkl, thank you for the prompt response.
I am currently in Salt Lake City consulting, (instead of caravanning around oz) and it's nice to be on the same
time frame and not have to wait 24 hrs to get a response from someone.

I knew Cpp was case sensitive but didn't realise that it extended through to FB when you link their objects.
That solved the problem.

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 2 guests