Re: [Msys2-users] Problems compiling very simple c++ project with cmake

2016-10-15 Thread Alan W. Irwin
On 2016-10-14 13:17-0700 David Grayson wrote:

> Also, isn't there some way to make a CMake Makefile print out the actual
> commands it's running?  Try "make VERBOSE=YES".

Note from my CMake experience, that should be

make VERBOSE=1

with either of "Unix Makefiles" or "MSYS Makefiles" generators.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__

Linux-powered Science
__

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users


Re: [Msys2-users] Problems compiling very simple c++ project with cmake

2016-10-14 Thread David Grayson
Hello, Michael.


I have used C++, CMake, and MSYS2 together successfully before.  Can you
try using the -G"MSYS Makefiles" argument instead of the one you are using
and see if that changes anything?  We usually use the "MSYS Makefiles"
generator.

Also, isn't there some way to make a CMake Makefile print out the actual
commands it's running?  Try "make VERBOSE=YES".

Also, while you are still debugging this, I would recommend not using "-j4"
because that can only make things worse when you're debugging a Makefile.

--David Grayson

On Thu, Oct 13, 2016 at 5:23 AM, Drobig, Michael, IN <
michael.dro...@asap-com.eu> wrote:

> Hello,
>
>
>
> i have got problems compiling a simple „Hello World“  like c++ Project
> with a fresh Msys2 installation and a MinGW64 Toolchain on Windows 7.
>
> Im using cmake to create the project.
>
>
>
> *CMakeLists.txt*
>
>
>
> cmake_minimum_required( VERSION 3.0 )
>
> project( helloName )
>
> add_executable(helloName main.cpp)
>
>
>
>
>
>
>
> *main.cpp*
>
>
>
> #include
>
> using namespace std;
>
>
>
> int main()
>
> {
>
> string name;
>
> cout << "Hello! Whats your name?";
>
> cin >> name;
>
> cout << "Hi, my name is " << name;
>
>
>
> return 0;
>
> }
>
>
>
>
>
> The following “cmake” operation works fine:
>
>
>
> cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
> -DCMAKE_ECLIPSE_VERSION=4.6.1 -DCMAKE_CXX_COMPILER_ARG1=-std=c++11
>
>
>
> But if I try “make –j4” I got the error:
>
>
>
> [ 50%] Building CXX object CMakeFiles/helloName.dir/main.cpp.obj
>
> [100%] Linking CXX executable helloName
>
> CMakeFiles/helloName.dir/main.cpp.obj: In function `main':
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:6: undefined reference to
> `std::__cxx11::basic_string,
> std::allocator >::basic_string()'
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:7: undefined reference to
> `std::basic_ostream >& std::operator<<
>  >(std::basic_ostream std::char_traits >&, char const*)'
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:8: undefined reference to
> `std::basic_istream >& std::operator>> std::char_traits, std::allocator >(std::basic_istre
> am >&, std::__cxx11::basic_string std::char_traits, std::allocator >&)'
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:9: undefined reference to
> `std::basic_ostream >& std::operator<<
>  >(std::basic_ostream std::char_traits >&, char const*)'
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:9: undefined reference to
> `std::basic_ostream >& std::operator<<  std::char_traits, std::allocator >(std::basic_ostr
> eam >&, std::__cxx11::basic_string std::char_traits, std::allocator > const&)'
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:6: undefined reference to
> `std::__cxx11::basic_string,
> std::allocator >::~basic_string()'
>
> C:/Work/DevEnv/mingw64_checking/main.cpp:6: undefined reference to
> `std::__cxx11::basic_string,
> std::allocator >::~basic_string()'
>
> CMakeFiles/helloName.dir/main.cpp.obj: In function `__tcf_0':
>
> C:/msys64/mingw64/include/c++/6.2.0/iostream:74: undefined reference to
> `std::ios_base::Init::~Init()'
>
> CMakeFiles/helloName.dir/main.cpp.obj: In function
> `__static_initialization_and_destruction_0':
>
> C:/msys64/mingw64/include/c++/6.2.0/iostream:74: undefined reference to
> `std::ios_base::Init::Init()'
>
> CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.data+0x0): undefined
> reference to `__gxx_personality_seh0'
>
> CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.xdata+0xc): undefined
> reference to `__gxx_personality_seh0'
>
> CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.rdata$.
> refptr._ZSt3cin[.refptr._ZSt3cin]+0x0): undefined reference to `std::cin'
>
> CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.rdata$.
> refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to
> `std::cout'
>
> collect2.exe: error: ld returned 1 exit status
>
> make[2]: *** [CMakeFiles/helloName.dir/build.make:95: helloName] Fehler 1
>
> make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/helloName.dir/all]
> Fehler 2
>
> make: *** [Makefile:84: all] Fehler 2
>
>
>
>
>
> Thank you,
>
>
>
> Michael
>
>
>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Msys2-users mailing list
> Msys2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/msys2-users
>
>
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users


[Msys2-users] Problems compiling very simple c++ project with cmake

2016-10-13 Thread Drobig, Michael, IN
Hello,

i have got problems compiling a simple "Hello World"  like c++ Project with a 
fresh Msys2 installation and a MinGW64 Toolchain on Windows 7.
Im using cmake to create the project.

CMakeLists.txt

cmake_minimum_required( VERSION 3.0 )
project( helloName )
add_executable(helloName main.cpp)



main.cpp

#include
using namespace std;

int main()
{
string name;
cout << "Hello! Whats your name?";
cin >> name;
cout << "Hi, my name is " << name;

return 0;
}


The following "cmake" operation works fine:

cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug 
-DCMAKE_ECLIPSE_VERSION=4.6.1 -DCMAKE_CXX_COMPILER_ARG1=-std=c++11

But if I try "make -j4" I got the error:

[ 50%] Building CXX object CMakeFiles/helloName.dir/main.cpp.obj
[100%] Linking CXX executable helloName
CMakeFiles/helloName.dir/main.cpp.obj: In function `main':
C:/Work/DevEnv/mingw64_checking/main.cpp:6: undefined reference to 
`std::__cxx11::basic_string, std::allocator 
>::basic_string()'
C:/Work/DevEnv/mingw64_checking/main.cpp:7: undefined reference to 
`std::basic_ostream >& std::operator<< 
 >(std::basic_ostream >&, char const*)'
C:/Work/DevEnv/mingw64_checking/main.cpp:8: undefined reference to 
`std::basic_istream >& std::operator>>, std::allocator >(std::basic_istre 
am >&, std::__cxx11::basic_string, std::allocator >&)'
C:/Work/DevEnv/mingw64_checking/main.cpp:9: undefined reference to 
`std::basic_ostream >& std::operator<< 
 >(std::basic_ostream >&, char const*)'
C:/Work/DevEnv/mingw64_checking/main.cpp:9: undefined reference to 
`std::basic_ostream >& std::operator<< , std::allocator >(std::basic_ostr  
   eam >&, std::__cxx11::basic_string, std::allocator > const&)'
C:/Work/DevEnv/mingw64_checking/main.cpp:6: undefined reference to 
`std::__cxx11::basic_string, std::allocator 
>::~basic_string()'
C:/Work/DevEnv/mingw64_checking/main.cpp:6: undefined reference to 
`std::__cxx11::basic_string, std::allocator 
>::~basic_string()'
CMakeFiles/helloName.dir/main.cpp.obj: In function `__tcf_0':
C:/msys64/mingw64/include/c++/6.2.0/iostream:74: undefined reference to 
`std::ios_base::Init::~Init()'
CMakeFiles/helloName.dir/main.cpp.obj: In function 
`__static_initialization_and_destruction_0':
C:/msys64/mingw64/include/c++/6.2.0/iostream:74: undefined reference to 
`std::ios_base::Init::Init()'
CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.data+0x0): undefined reference 
to `__gxx_personality_seh0'
CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.xdata+0xc): undefined 
reference to `__gxx_personality_seh0'
CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.rdata$.refptr._ZSt3cin[.refptr._ZSt3cin]+0x0):
 undefined reference to `std::cin'
CMakeFiles/helloName.dir/main.cpp.obj:main.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0):
 undefined reference to `std::cout'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/helloName.dir/build.make:95: helloName] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/helloName.dir/all] Fehler 2
make: *** [Makefile:84: all] Fehler 2


Thank you,

Michael


--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users