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

Compile issue 'undefined reference to straw' #7

Closed
mmterpstra opened this issue Feb 16, 2017 · 8 comments
Closed

Compile issue 'undefined reference to straw' #7

mmterpstra opened this issue Feb 16, 2017 · 8 comments

Comments

@mmterpstra
Copy link

Cannot use the current straw.cpp to find the straw function but by including the ../python/old the compilation works:

straw-86c2939e3695e31a5a41f53cc1231f7fcb77fb87/C++$ g++ -lz -std=c++11 -o straw main.cpp straw.cpp
/tmp/cc4rs88z.o:main.cpp:function main: error: undefined reference to 'straw(std::string, std::string, int, std::string, std::string, std::string, std::vector<int, std::allocator<int> >&, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&)'
#working version
straw-86c2939e3695e31a5a41f53cc1231f7fcb77fb87/C++$ g++ -lz -std=c++11 -o straw main.cpp straw.cpp ../python/old/straw.cpp

ps: also try to include a makefile or include it into the README for this project.

@mmterpstra mmterpstra changed the title Compile issue 'undefined reference to straw' function Compile issue 'undefined reference to straw' Feb 16, 2017
@nchernia
Copy link
Contributor

nchernia commented Feb 16, 2017 via email

@mmterpstra
Copy link
Author

I've seen the wiki yes.
PS: I use centos with the lua bases environment module system (lmod) and software build with easybuild. my env is something like:
$ ml -t list
EasyBuild/2.1.1
GCC/4.9.3-binutils-2.25
binutils/2.25-GCC-4.9.3-binutils-2.25
GNU/4.9.3-2.25
numactl/2.0.10-GNU-4.9.3-2.25
hwloc/1.11.0-GNU-4.9.3-2.25
OpenMPI/1.8.8-GNU-4.9.3-2.25
OpenBLAS/0.2.14-GNU-4.9.3-2.25-LAPACK-3.5.0
gompi/2015b
FFTW/3.3.4-gompi-2015b
ScaLAPACK/2.0.2-gompi-2015b-OpenBLAS-0.2.14-LAPACK-3.5.0
foss/2015b
zlib/1.2.8-foss-2015b
libreadline/6.3-foss-2015b
ncurses/5.9-foss-2015b
libpng/1.6.21-foss-2015b
NASM/2.11.08-foss-2015b
libjpeg-turbo/1.4.2-foss-2015b
LibTIFF/4.0.4-foss-2015b
Tcl/8.6.4-foss-2015b
Tk/8.6.4-foss-2015b-no-X11
cURL/7.47.1-foss-2015b
libxml2/2.9.2-foss-2015b
bzip2/1.0.6-foss-2015b
freetype/2.6.1-foss-2015b
pixman/0.32.8-foss-2015b
fontconfig/2.11.94-foss-2015b
expat/2.1.0-foss-2015b
cairo/1.14.6-foss-2015b
Java/1.8.0_45
PCRE/8.37-foss-2015b
R/3.2.1-foss-2015b

@mmterpstra
Copy link
Author

this is a suggested makefile:
CC=g++
#for linux
CPPFLAGS=-O2 -lz -std=c++11
#for mac
#CPPFLAGS=-O2 -lz
#for windows
#CPPFLAGS=???

bin/straw: C++/straw.cpp C++/main.cpp C++/straw.h
cd C++ && $(CC) $(CPPFLAGS) main.cpp straw.cpp ../python/old/straw.cpp -o ../$@

@nchernia
Copy link
Contributor

nchernia commented Feb 16, 2017 via email

@nchernia
Copy link
Contributor

nchernia commented Feb 16, 2017 via email

@nchernia
Copy link
Contributor

nchernia commented Feb 16, 2017 via email

@mmterpstra
Copy link
Author

After a new login it works...might be our module system giving quirks. Sorry for the bother.

$ g++ -lz -std=c++11 -o straw main.cpp straw.cpp

/straw-86c2939e3695e31a5a41f53cc1231f7fcb77fb87/C++$ ml -t list
EasyBuild/2.1.1
GCC/4.9.3-binutils-2.25
binutils/2.25-GCC-4.9.3-binutils-2.25
GNU/4.9.3-2.25
numactl/2.0.10-GNU-4.9.3-2.25
hwloc/1.11.0-GNU-4.9.3-2.25
OpenMPI/1.8.8-GNU-4.9.3-2.25
OpenBLAS/0.2.14-GNU-4.9.3-2.25-LAPACK-3.5.0
gompi/2015b
FFTW/3.3.4-gompi-2015b
ScaLAPACK/2.0.2-gompi-2015b-OpenBLAS-0.2.14-LAPACK-3.5.0
foss/2015b
R/3.2.2-foss-2015b-bioconductor
zlib/1.2.8-foss-2015b

@nchernia
Copy link
Contributor

nchernia commented Feb 17, 2017 via email

sa501428 added a commit that referenced this issue Jun 4, 2021
sa501428 added a commit that referenced this issue Jun 4, 2021
Merge pull request #7 from PhanstielLab/master
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

2 participants