Problem with linking ForexConnect API linux shared library

Moderator: Moderator

Problem with linking ForexConnect API linux shared library

Postby kanadea » Fri Dec 16, 2011 7:23 am

I'm trying to get my env setup to write C++ application on linux.

So I have a very basic main.cpp that makes a call to createSession() and returns.

Now when I try to link using,
$ g++ main.o -o main.exe -L /usr/lib -l :liborder2go2.so

I get an error saying liboreder2go2 is not in correct format, linker can not read the file.

I could see the contents of the file using "nm -D liborder2go2.so".
Also, I am quite sure I am using 32-bit version which is required by my system.

Can someone help with what could be wrong here?

thanks!
kanadea
 
Posts: 2
Joined: Thu Dec 15, 2011 10:27 am

Re: Problem with linking ForexConnect API linux shared library

Postby sunshine » Mon Dec 19, 2011 8:35 am

When building applications, it's necessary to link liborder2go2.so and other dependent libraries located in the folder with liborder2go2.so. For example, if all libraries are located in the folder with main.cpp, you can do that using the following command:

g++ -c main.cpp -o main.o
g++ main.o -o main.exe -L . -lorder2go2 -lgstool2 -lgsexpat -lfxmsg

You can also copy *.so in to /usr/lib manually to use the libraries in future without specifying the path to them.

I hope this will help.
sunshine
 

Re: Problem with linking ForexConnect API linux shared library

Postby kanadea » Sat Dec 24, 2011 7:47 am

Thanks for your help!

I think my problem was different. I was using incorrect cross-compilation environment on Windows.

Now I am able to build the sample code in 'SimpleSamples'.
Also, running test app to login with my userid was successful.
kanadea
 
Posts: 2
Joined: Thu Dec 15, 2011 10:27 am


Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 2 guests