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

Using waffle with cygwin g++ in windows OS #29

Open
aveshd opened this issue Oct 26, 2016 · 5 comments
Open

Using waffle with cygwin g++ in windows OS #29

aveshd opened this issue Oct 26, 2016 · 5 comments

Comments

@aveshd
Copy link

aveshd commented Oct 26, 2016

Hi,

I am trying to make small test program in cygwin environment. Here is what I did

include

include "GMatrix.h"

using namespace GClasses;
int main(int argc, char const *argv[]) {
GMatrix M;
GCSVParser p;
p.parse(M, "data/data.csv");
std::cout << "Finished" << std::endl;
return 0;

}

I am trying to follow the help documentation, just to test the plumbing.
But when I try to compile using following command

g++ -std=c++11 -g -I /lib/waffles/GClasses -L /lib/waffles/GClasses -lGClasses main.cpp -o main.exe

I get following error, which looks more like linker error. I built the GClasses.lib library in MSVC 2015. But it is not working.
I also did the search on the google and found a link but not much.

Please let me know if I am missing something obvious, please note I have little to none experience with MSVC, I mainly work with GCC.

Please pardon my ignorance if I missed something trivial.

Here is the error:

undefined reference to `GClasses::GMatrix::~GMatrix()'

undefined reference to `GClasses::GCSVParser::~GCSVParser()'

Thank you,
Regards,
Avesh

@mikegashler
Copy link
Owner

I managed to reproduce this error, but I could not figure out how to fix it. My guess is that the Cygwin version of g++ may not know how to link with libraries built by MSVC. I suppose the solution would be to build it all in Cygwin. I have never tried building in Cygwin before, but the code does build on several other platforms (Linux with g++, Mac with clang, Sparc with g++, Windows with MSVC, and someone said he got it working in mingw), so I suspect it can be made to work in Cygwin too.

@aveshd
Copy link
Author

aveshd commented Oct 27, 2016

I think problem is much more complicated than I thought:
Here is a link where somebody has addressed this problem, but did not find the solution
http://stackoverflow.com/questions/24407762/cygwin-gcc-linking-with-visual-studio-library

Here are interesting comments from MinGw page,

http://www.mingw.org/wiki/Interoperability_of_Libraries_Created_by_Different_Compiler_Brands

Thanks,

@StephenAshmore
Copy link
Collaborator

I believe the fix for this is to compile the waffles library entirely in Cygwin, and link to that version. I'm not sure they are designed to talk to each other. You should be able to compile waffles using g++ in cygwin, and get it running without the need for the MSVC.

@aveshd
Copy link
Author

aveshd commented Nov 2, 2016

I tried compiling it with Cygwin but it uses some of the windows specific header file. I started fixing some of the things but soon realized that it is not going to be easy. I will try to give it one more attempt and report back if I can find a break through.

@mikegashler
Copy link
Owner

When building on Windows, I use the compiler definition "WINDOWS", and the code only includes Windows-specific header files if this is defined. So, if you do not want to include any Windows-specific header files, just make sure that is not defined.

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