You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This error only happens if I call it from a shell script called by Sublime Text .sublime-build file. If I directly call the command g++ --std=c++11 main.cpp -I. -I./yaml-cpp/include -L./yaml-cpp -lyaml-cpp -o main on a command line as mintty 2.6.2 (x86_64-pc-cygwin), it works correctly.
It is expected to the linker to be able to link from Sublime Text.
Actual behavior
undefined reference to `YAML::Parser::~Parser()
C:\Users\PROFES~1\AppData\Local\Temp\ccRhYWZh.o:main.cpp:(.text+0x1b1): undefined reference to `YAML::Parser::Parser(std::istream&)'
C:\Users\PROFES~1\AppData\Local\Temp\ccRhYWZh.o:main.cpp:(.text+0x2d8): undefined reference to `YAML::Parser::~Parser()'
C:\Users\PROFES~1\AppData\Local\Temp\ccRhYWZh.o:main.cpp:(.text+0x38e): undefined reference to `YAML::Parser::~Parser()'
collect2.exe: error: ld returned 1 exit status
Press Ctrl+Shift+B and select the Build Main file option. You will get:
undefined reference to `YAML::Parser::~Parser()
C:\Users\PROFES~1\AppData\Local\Temp\ccRhYWZh.o:main.cpp:(.text+0x1b1): undefined reference to `YAML::Parser::Parser(std::istream&)'
C:\Users\PROFES~1\AppData\Local\Temp\ccRhYWZh.o:main.cpp:(.text+0x2d8): undefined reference to `YAML::Parser::~Parser()'
C:\Users\PROFES~1\AppData\Local\Temp\ccRhYWZh.o:main.cpp:(.text+0x38e): undefined reference to `YAML::Parser::~Parser()'
collect2.exe: error: ld returned 1 exit status
But that error only happens if you call make_run.sh from Sublime Text build file. If you open a shell command line as mintty 2.6.2 (x86_64-pc-cygwin) it works correctly calling ./make_run.sh to build.
Why Sublime Text is making the linker ld.exe not link?
Environment
Operating system and version:
Windows 10 @ mintty 2.6.2 (x86_64-pc-cygwin)
Mac OS ...
Linux ...
Sublime Text:
Build 3114
I am on windows with Cygwin:
$ g++ --version
g++ (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ld --version
GNU ld (GNU Binutils) 2.25.2
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
if you execute sh make_run.sh main from a Windows Command Prompt when in the project direcdory, what happens? and does sh launch this mintty 2.6.2 (x86_64-pc-cygwin) shell of yours?
This happens: (it does compile successfully, which is the opposite of running it from Sublime Text build)
It does not launch a windows because I am not launching the mintty shell terminal anywhere on that script. It cannot magically open, but if you put this on the shell script called open_shell.sh and inside it call sh make_run.sh main, it does launch the mintty shell terminal if I call open_shell.sh instead of make_run.sh on the Sublime Text build:
CURRENT_PATH=$(pwd)
COMMAND_TO_RUN="pwd; echo $CURRENT_PATH; cd $CURRENT_PATH; sh make_run.sh $@"
current_terminal="mintty"
if command -v $current_terminal >/dev/null 2>&1; then
/bin/$current_terminal -w max -h always -e /bin/bash --login -i -c "$COMMAND_TO_RUN"
exit 0
fi
The only thing to do overcome these problems is launching a new window running a full shell terminal, as showed on the StackOverflow answer above, instead of relying on the Sublime Text build system/environment.
Expected behavior
This error only happens if I call it from a shell script called by Sublime Text
.sublime-build
file. If I directly call the commandg++ --std=c++11 main.cpp -I. -I./yaml-cpp/include -L./yaml-cpp -lyaml-cpp -o main
on a command line asmintty 2.6.2 (x86_64-pc-cygwin)
, it works correctly.It is expected to the linker to be able to link from Sublime Text.
Actual behavior
undefined reference to `YAML::Parser::~Parser()
Steps to reproduce
Clone the project https://github.com/jbeder/yaml-cpp
Open a command line as
mintty.exe
shell onyaml-cpp
folder and build it on windows@cygwin with:yaml-cpp
you just cloned:This is the Sublime Text
project.sublime-project
:And this is the
make_run.sh
file:Create this file named
main.cpp
:Ctrl+Shift+B
and select theBuild Main file
option. You will get:undefined reference to `YAML::Parser::~Parser()
But that error only happens if you call
make_run.sh
from Sublime Text build file. If you open a shell command line asmintty 2.6.2 (x86_64-pc-cygwin)
it works correctly calling./make_run.sh
to build.Why Sublime Text is making the
linker
ld.exe not link?Environment
I am on windows with Cygwin:
Other issues:
The text was updated successfully, but these errors were encountered: