Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building project on Linux #143

Closed
SerhiiYashchuk opened this issue Oct 13, 2013 · 25 comments
Closed

Building project on Linux #143

SerhiiYashchuk opened this issue Oct 13, 2013 · 25 comments

Comments

@SerhiiYashchuk
Copy link

When I try to build my project I get a lot of "undefined reference to" errors. This is my first project on Linux, so I have no guess what should I do. All my projects were built on Windows without any problems.

@DarthMike
Copy link
Owner

Have you followed the steps in wiki? http://indielib.com/wiki/index.php?title=Building_IndieLib

@SerhiiYashchuk
Copy link
Author

Yeah. I've built all the dependencies as it is said in wiki. Even if I try to build the first tutorial, I get that errors.

@SerhiiYashchuk
Copy link
Author

When I got similar error on Windows, I just added "#pragma comment (lib, "IndieLib.lib")" to CIndieLib_vc2008.h and it worked. But I can't do the same here.

@DarthMike
Copy link
Owner

Hm, what error do you get exactly? We moved along from having the Visual studio pragma to link. Lib should be linked by compiler settings. It would be good to know what distro you are running too.

@SerhiiYashchuk
Copy link
Author

I get "undefined reference to <func_name>" for all the IndieLib functions that are called.
I use Ubuntu 12.04.

@DarthMike
Copy link
Owner

By the way, you can take a look at our configuration for the test and tutorials to link against the library.

You will need LD flag, to link against indielib: -lIndieLib

For example, for tutorial 01 automake file:
https://github.com/DarthMike/indielib-crossplatform/blob/master/IndieLib/linux/tutorials/basic/01_Installing/Makefile.am

@SerhiiYashchuk
Copy link
Author

Where do I have to use this flag?

@SerhiiYashchuk
Copy link
Author

By the way, if I remove that pragma I get this:
CIndieLib_vc2008.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall IND_Math::init(void)"
...

@DarthMike
Copy link
Owner

Hm. that declaration is windows, not linux code. What version of indielib are you trying to build against? Did you try latest master? I've compiled it just now under Debian.

@SerhiiYashchuk
Copy link
Author

Ok. I'll try to add that flag.

@DarthMike
Copy link
Owner

can you update to latest master? It's quite stable right now. If you can post any makefile here we can help you in getting it right to link against Indielib

@SerhiiYashchuk
Copy link
Author

I use the latest version. Updated two hours ago. I use Code::Blocks, so I have no idea about makefile. (Have no experience in building on Linux).

@DarthMike
Copy link
Owner

Hmm, I never used Code::Blocks... BUT, you need to link against indielib in your project somehow. Maybe this would help, (sorry I just throw first thing returned from google search, which has some meaning to me): http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/

@SerhiiYashchuk
Copy link
Author

I found how to link to the library but I have to select the lib file. Have no idea where it is.

@SerhiiYashchuk
Copy link
Author

Or can you tell me the easiest way to build my project without any IDE?

@DarthMike
Copy link
Owner

Regarding of where the lib file is, you will see it when you make:
autoreconf
sudo ./configure --prefix=/home/michael/indielib/IndieLib
make clean all

To build indielib

It generally should be in /usr/local/lib/ after you built and installed indielib in your system

@DarthMike
Copy link
Owner

The easiest way is whatever is more comfortable for you :)

makefiles can be 'easier', but if you will start to hack a bigger project they become a hassle. so you can stick with Code::Blocks. Problem is we don't support it directly. We want to make CMake a priority, so anybody could choose to which IDE work using CMake to generate project files. Will come in due time ...

@SerhiiYashchuk
Copy link
Author

There is no IndieLib in /usr/local/lib. I guess there were some errors in building it. Gonna check it out tomorrow.

@SerhiiYashchuk
Copy link
Author

Ok. There were some problems with building IndieLib. After doing 'autoreconf' I had to do next:
sudo make
sudo make install prefix=/usr/local
make clean all

After this commands I finally have libIndieLib in my /usr/local/lib.
Gonna try to build a project.

@SerhiiYashchuk
Copy link
Author

Tried to build project. Linked it to IndieLib. Then I had to link FreeImage, GLEW and SDL. Now I get errors about undefined reference to OpenGL functions.

@DarthMike
Copy link
Owner

Yes this is not totally correct on our side, we will fix it. You should not need to link against dependencies again in the app using indielib.

Just add gl to the linked libs, should be in your system already.

Glad you could advance further with the problem.

@SerhiiYashchuk
Copy link
Author

Actualy I need to link dependencies, because there is the same problem with them - undefined reference. The only problem left is to find GL libs. Couldn't find them.

@M-F-K
Copy link
Collaborator

M-F-K commented Oct 14, 2013

I think it's the Glew dependencies. If you take a look under the Linux part in the wiki, they are mentioned : http://indielib.com/wiki/index.php?title=Building_IndieLib

@DarthMike
Copy link
Owner

@Sergey-Yaschuk Did you suceed? Can we close this issue?

@SerhiiYashchuk
Copy link
Author

Yeah. You can close it. Thanks for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants