Hello and thank you for your help in advance (I'm a bit of a newbie). I am on ubuntu 18.
I am trying to install an older version of some software called HepMC (need older version for project) and I had no problem installing the slightly newer version. When I try to build from source I get an error on the make command. I've seen this "all-recurive failed" error all over the web, but the solutions I've seen for other people have seemed to be very software specific and have not helped me.
I am not really sure how to interpret this error and I haven't been able to find a good answer. Any tips or suspicions on what might be going on here would be greatly appreciated. Been bashing my head against this for awhile
Before running make I did
autoreconf -i configure.ac
./configure
and this ran with no errors or warnings.
Here's the snippet where the error seems to begin, I'll attach the full printout from "make" down below.
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:408:80: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^
../HepMC/GenEvent.h:459:71: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenEvent.h:459:71: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:459:80: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^
CommonIO.cc: In member function ‘HepMC::HeavyIon* HepMC::CommonIO::read_heavy_ion(std::istream*)’:
CommonIO.cc:318:9: warning: converting ‘false’ to pointer type ‘HepMC::HeavyIon*’ [-Wconversion-null]
return false;
^~~~~
CommonIO.cc:328:26: warning: converting ‘false’ to pointer type ‘HepMC::HeavyIon*’ [-Wconversion-null]
if( nh == 0 ) return false;
^~~~~
CommonIO.cc: In member function ‘HepMC::PdfInfo* HepMC::CommonIO::read_pdf_info(std::istream*)’:
CommonIO.cc:344:9: warning: converting ‘false’ to pointer type ‘HepMC::PdfInfo*’ [-Wconversion-null]
return false;
^~~~~
CommonIO.cc:356:27: warning: converting ‘false’ to pointer type ‘HepMC::PdfInfo*’ [-Wconversion-null]
if( id1 == 0 ) return false;
^~~~~
CommonIO.cc: In member function ‘HepMC::GenVertex* HepMC::CommonIO::read_vertex(std::istream*, HepMC::TempParticleMap&)’:
CommonIO.cc:374:9: warning: converting ‘false’ to pointer type ‘HepMC::GenVertex*’ [-Wconversion-null]
return false;
^~~~~
CommonIO.cc: In member function ‘HepMC::GenParticle* HepMC::CommonIO::read_particle(std::istream*, HepMC::TempParticleMap&)’:
CommonIO.cc:411:9: warning: converting ‘false’ to pointer type ‘HepMC::GenParticle*’ [-Wconversion-null]
return false;
^~~~~
Makefile:478: recipe for target 'CommonIO.lo' failed
make[1]: *** [CommonIO.lo] Error 1
make[1]: Leaving directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/src'
Makefile:397: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
and here's the full return of make
make
Making all in HepMC
make[1]: Entering directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/HepMC'
make all-am
make[2]: Entering directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/HepMC'
make[2]: Leaving directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/HepMC'
make[1]: Leaving directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/HepMC'
Making all in src
make[1]: Entering directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/src'
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../HepMC -I.. -I.. -ansi -pedantic -Wall -g -O2 -MT CommonIO.lo -MD -MP -MF .deps/CommonIO.Tpo -c -o CommonIO.lo CommonIO.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../HepMC -I.. -I.. -ansi -pedantic -Wall -g -O2 -MT CommonIO.lo -MD -MP -MF .deps/CommonIO.Tpo -c CommonIO.cc -fPIC -DPIC -o .libs/CommonIO.o
In file included from ../HepMC/GenEvent.h:123:0,
from ../HepMC/CommonIO.h:15,
from CommonIO.cc:11:
../HepMC/GenVertex.h:173:71: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenVertex.h:173:71: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/GenEvent.h:123:0,
from ../HepMC/CommonIO.h:15,
from CommonIO.cc:11:
../HepMC/GenVertex.h:173:80: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^
../HepMC/GenVertex.h:237:69: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenVertex*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenVertex.h:237:69: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/GenEvent.h:123:0,
from ../HepMC/CommonIO.h:15,
from CommonIO.cc:11:
../HepMC/GenVertex.h:237:78: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenVertex*,ptrdiff_t>{
^
../HepMC/GenVertex.h:307:64: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,GenParticle*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenVertex.h:307:64: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/GenEvent.h:123:0,
from ../HepMC/CommonIO.h:15,
from CommonIO.cc:11:
../HepMC/GenVertex.h:307:73: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,GenParticle*,ptrdiff_t>{
^
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:289:69: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenVertex*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenEvent.h:289:69: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:289:78: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenVertex*,ptrdiff_t>{
^
../HepMC/GenEvent.h:341:69: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenVertex*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenEvent.h:341:69: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:341:78: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenVertex*,ptrdiff_t>{
^
../HepMC/GenEvent.h:408:71: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenEvent.h:408:71: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:408:80: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^
../HepMC/GenEvent.h:459:71: error: ‘ptrdiff_t’ was not declared in this scope
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^~~~~~~~~
../HepMC/GenEvent.h:459:71: note: suggested alternatives:
In file included from /usr/include/c++/7/string:38:0,
from CommonIO.cc:8:
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:232:28: note: ‘std::ptrdiff_t’
In file included from ../HepMC/CommonIO.h:15:0,
from CommonIO.cc:11:
../HepMC/GenEvent.h:459:80: error: template argument 3 is invalid
public std::iterator<std::forward_iterator_tag,HepMC::GenParticle*,ptrdiff_t>{
^
CommonIO.cc: In member function ‘HepMC::HeavyIon* HepMC::CommonIO::read_heavy_ion(std::istream*)’:
CommonIO.cc:318:9: warning: converting ‘false’ to pointer type ‘HepMC::HeavyIon*’ [-Wconversion-null]
return false;
^~~~~
CommonIO.cc:328:26: warning: converting ‘false’ to pointer type ‘HepMC::HeavyIon*’ [-Wconversion-null]
if( nh == 0 ) return false;
^~~~~
CommonIO.cc: In member function ‘HepMC::PdfInfo* HepMC::CommonIO::read_pdf_info(std::istream*)’:
CommonIO.cc:344:9: warning: converting ‘false’ to pointer type ‘HepMC::PdfInfo*’ [-Wconversion-null]
return false;
^~~~~
CommonIO.cc:356:27: warning: converting ‘false’ to pointer type ‘HepMC::PdfInfo*’ [-Wconversion-null]
if( id1 == 0 ) return false;
^~~~~
CommonIO.cc: In member function ‘HepMC::GenVertex* HepMC::CommonIO::read_vertex(std::istream*, HepMC::TempParticleMap&)’:
CommonIO.cc:374:9: warning: converting ‘false’ to pointer type ‘HepMC::GenVertex*’ [-Wconversion-null]
return false;
^~~~~
CommonIO.cc: In member function ‘HepMC::GenParticle* HepMC::CommonIO::read_particle(std::istream*, HepMC::TempParticleMap&)’:
CommonIO.cc:411:9: warning: converting ‘false’ to pointer type ‘HepMC::GenParticle*’ [-Wconversion-null]
return false;
^~~~~
Makefile:478: recipe for target 'CommonIO.lo' failed
make[1]: *** [CommonIO.lo] Error 1
make[1]: Leaving directory '/home/maxfieg/Desktop/FelixResearch/junk/hep_build2/HepMC2.04/src'
Makefile:397: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Related
I am trying to build a simple network using torch. But when I try to build the project it returns some error messages like error: ‘ReLU’ is not a member of ‘torch::nn’
My network definitions is as follows:
#pragma once
#include <torch/torch.h>
class ConvNetImpl : public torch::nn::Module {
public:
explicit ConvNetImpl(int64_t num_classes = 10);
torch::Tensor forward(torch::Tensor x);
private:
torch::nn::Sequential layer1{
torch::nn::Conv2d(torch::nn::Conv2dOptions(1, 16, 5).stride(1).padding(2)),
torch::nn::BatchNorm2d(16),
torch::nn::ReLU(),
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
};
torch::nn::Sequential layer2{
torch::nn::Conv2d(torch::nn::Conv2dOptions(16, 32, 5).stride(1).padding(2)),
torch::nn::BatchNorm2d(32),
torch::nn::ReLU(),
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
};
torch::nn::Linear fc;
};
TORCH_MODULE(ConvNet);
When I try to build with: cmake --build . --config Release
It returns me this message:
[ 33%] Building CXX object CMakeFiles/freespace_torch.dir/src/convnet.cpp.o
In file included from /home/fugurcal/freespace_torch/src/convnet.cpp:2:0:
/home/fugurcal/freespace_torch/include/convnet.h:13:20: error: ‘BatchNorm2d’ is not a member of ‘torch::nn’
torch::nn::BatchNorm2d(16),
^~~~~~~~~~~
/home/fugurcal/freespace_torch/include/convnet.h:13:20: note: suggested alternative: ‘BatchNorm’
torch::nn::BatchNorm2d(16),
^~~~~~~~~~~
BatchNorm
/home/fugurcal/freespace_torch/include/convnet.h:14:20: error: ‘ReLU’ is not a member of ‘torch::nn’
torch::nn::ReLU(),
^~~~
/home/fugurcal/freespace_torch/include/convnet.h:15:20: error: ‘MaxPool2d’ is not a member of ‘torch::nn’
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
^~~~~~~~~
/home/fugurcal/freespace_torch/include/convnet.h:15:41: error: ‘MaxPool2dOptions’ is not a member of ‘torch::nn’
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
^~~~~~~~~~~~~~~~
/home/fugurcal/freespace_torch/include/convnet.h:15:41: note: suggested alternative: ‘Conv2dOptions’
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
^~~~~~~~~~~~~~~~
Conv2dOptions
/home/fugurcal/freespace_torch/include/convnet.h:16:5: error: could not convert ‘{torch::nn::Conv2d((* &(& torch::nn::ConvOptions<2>(1, 16, torch::ExpandingArray<2, long int>(5)).torch::nn::ConvOptions<2>::stride(torch::ExpandingArray<2, long int>(1)))->torch::nn::ConvOptions<2>::padding(torch::ExpandingArray<2, long int>(2)))), <expression error>, <expression error>, <expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘torch::nn::Sequential’
};
^
/home/fugurcal/freespace_torch/include/convnet.h:20:20: error: ‘BatchNorm2d’ is not a member of ‘torch::nn’
torch::nn::BatchNorm2d(32),
^~~~~~~~~~~
/home/fugurcal/freespace_torch/include/convnet.h:20:20: note: suggested alternative: ‘BatchNorm’
torch::nn::BatchNorm2d(32),
^~~~~~~~~~~
BatchNorm
/home/fugurcal/freespace_torch/include/convnet.h:21:20: error: ‘ReLU’ is not a member of ‘torch::nn’
torch::nn::ReLU(),
^~~~
/home/fugurcal/freespace_torch/include/convnet.h:22:20: error: ‘MaxPool2d’ is not a member of ‘torch::nn’
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
^~~~~~~~~
/home/fugurcal/freespace_torch/include/convnet.h:22:41: error: ‘MaxPool2dOptions’ is not a member of ‘torch::nn’
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
^~~~~~~~~~~~~~~~
/home/fugurcal/freespace_torch/include/convnet.h:22:41: note: suggested alternative: ‘Conv2dOptions’
torch::nn::MaxPool2d(torch::nn::MaxPool2dOptions(2).stride(2))
^~~~~~~~~~~~~~~~
Conv2dOptions
/home/fugurcal/freespace_torch/include/convnet.h:23:5: error: could not convert ‘{torch::nn::Conv2d((* &(& torch::nn::ConvOptions<2>(16, 32, torch::ExpandingArray<2, long int>(5)).torch::nn::ConvOptions<2>::stride(torch::ExpandingArray<2, long int>(1)))->torch::nn::ConvOptions<2>::padding(torch::ExpandingArray<2, long int>(2)))), <expression error>, <expression error>, <expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘torch::nn::Sequential’
};
^
CMakeFiles/freespace_torch.dir/build.make:62: recipe for target 'CMakeFiles/freespace_torch.dir/src/convnet.cpp.o' failed
make[2]: *** [CMakeFiles/freespace_torch.dir/src/convnet.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/freespace_torch.dir/all' failed
make[1]: *** [CMakeFiles/freespace_torch.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I know mentioned methods are member of torch::nn. How can I resolve this issue?
Issue solved. While making "cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch .." my libtorch directory was "/home/user/folder/libtorch". After changing the libtorch directory to "/home/user/libtorch" issue solved.
UPDATE: I've gone through and added some apparently missing dependecies of <cwchar> in the files mentioned in the build log. Now I'm down to what appears to be a problem with my cwchar header itself, where it's missing a bunch of declarations. Here's the new build log:
C:\Windows\system32\cmd.exe /C C:/MinGW/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ ncrv3 - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Michael/Documents/temp/ncrv3'
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/main.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/main.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\string:40,
from C:/Users/Michael/Documents/temp/ncrv3/main.cpp:4:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:177:11: error: '::wcscat' has not been declared
using ::wcscat;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:178:11: error: '::wcscmp' has not been declared
using ::wcscmp;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:179:11: error: '::wcscoll' has not been declared
using ::wcscoll;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:180:11: error: '::wcscpy' has not been declared
using ::wcscpy;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:181:11: error: '::wcscspn' has not been declared
using ::wcscspn;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:183:11: error: '::wcslen' has not been declared
using ::wcslen;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:184:11: error: '::wcsncat' has not been declared
using ::wcsncat;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:185:11: error: '::wcsncmp' has not been declared
using ::wcsncmp;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:186:11: error: '::wcsncpy' has not been declared
using ::wcsncpy;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:188:11: error: '::wcsspn' has not been declared
using ::wcsspn;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:193:11: error: '::wcstok' has not been declared
using ::wcstok;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:196:11: error: '::wcsxfrm' has not been declared
using ::wcsxfrm;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:204:11: error: '::wcschr' has not been declared
using ::wcschr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:205:11: error: '::wcspbrk' has not been declared
using ::wcspbrk;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:206:11: error: '::wcsrchr' has not been declared
using ::wcsrchr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:207:11: error: '::wcsstr' has not been declared
using ::wcsstr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:213:55: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:212:3: note: initializing argument 1 of 'wchar_t* std::wcschr(wchar_t*, wchar_t)'
wcschr(wchar_t* __p, wchar_t __c)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:217:58: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:216:3: note: initializing argument 1 of 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)'
wcspbrk(wchar_t* __s1, const wchar_t* __s2)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:221:56: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:220:3: note: initializing argument 1 of 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)'
wcsrchr(wchar_t* __p, wchar_t __c)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:225:57: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:224:3: note: initializing argument 1 of 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)'
wcsstr(wchar_t* __s1, const wchar_t* __s2)
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\string:40:0,
from C:/Users/Michael/Documents/temp/ncrv3/main.cpp:4:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h: In static member function 'static std::size_t std::char_traits<wchar_t>::length(const char_type*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:358:26: error: 'wcslen' was not declared in this scope
{ return wcslen(__s); }
^
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
mingw32-make.exe: *** [All] Error 2
ncrv3.mk:105: recipe for target 'Debug/main.cpp.o' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Michael/Documents/temp/ncrv3'
Makefile:4: recipe for target 'All' failed
====1 errors, 4 warnings====
OLD:
I want to include the Box2d (2.3.0) library in my command-line project, which I'm working on in CodeLite 9.2.8. There's nothing in Box2d's documentation about codelite support.
Because there's no relevant setup instructions, I tried taking the entire library (Box2D-Master/Box2D/Box2D) and placing it in my project folder, to dynamically link it. Before I even #include "Box2D/Box2D.h", I get 8 warnings leading to one error in the build. What am I doing wrong?
It looks like some declarations are missing, but I have the entire Box2D library here.
There are also some invalid conversions between const wchar* and wchar*.
In my compiler settings, I HAVE enabled c++11 support with -std=c++11. Here is my entire build log.
C:\Windows\system32\cmd.exe /C C:/MinGW/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ ncrv3 - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Michael/Documents/temp/ncrv3'
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Dynamics/b2Body.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Dynamics_b2Body.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Dynamics/b2World.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Dynamics_b2World.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Dynamics/b2WorldCallbacks.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Dynamics_b2WorldCallbacks.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Collision/b2BroadPhase.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Collision_b2BroadPhase.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\random:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stl_algo.h:66,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\algorithm:62,
from ./Box2D/Collision/b2BroadPhase.h:25,
from ./Box2D/Dynamics/b2ContactManager.h:22,
from ./Box2D/Dynamics/b2World.h:25,
from C:/Users/Michael/Documents/temp/ncrv3/Box2D/Dynamics/b2World.cpp:19:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:177:11: error: '::wcscat' has not been declared
using ::wcscat;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:178:11: error: '::wcscmp' has not been declared
using ::wcscmp;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:179:11: error: '::wcscoll' has not been declared
using ::wcscoll;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:180:11: error: '::wcscpy' has not been declared
using ::wcscpy;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:181:11: error: '::wcscspn' has not been declared
using ::wcscspn;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:183:11: error: '::wcslen' has not been declared
using ::wcslen;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:184:11: error: '::wcsncat' has not been declared
using ::wcsncat;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:185:11: error: '::wcsncmp' has not been declared
using ::wcsncmp;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:186:11: error: '::wcsncpy' has not been declared
using ::wcsncpy;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:188:11: error: '::wcsspn' has not been declared
using ::wcsspn;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:193:11: error: '::wcstok' has not been declared
using ::wcstok;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:196:11: error: '::wcsxfrm' has not been declared
using ::wcsxfrm;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:204:11: error: '::wcschr' has not been declared
using ::wcschr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:205:11: error: '::wcspbrk' has not been declared
using ::wcspbrk;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:206:11: error: '::wcsrchr' has not been declared
using ::wcsrchr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:207:11: error: '::wcsstr' has not been declared
using ::wcsstr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:213:55: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:212:3: note: initializing argument 1 of 'wchar_t* std::wcschr(wchar_t*, wchar_t)'
wcschr(wchar_t* __p, wchar_t __c)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:217:58: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:216:3: note: initializing argument 1 of 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)'
wcspbrk(wchar_t* __s1, const wchar_t* __s2)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:221:56: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:220:3: note: initializing argument 1 of 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)'
wcsrchr(wchar_t* __p, wchar_t __c)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:225:57: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:224:3: note: initializing argument 1 of 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)'
wcsstr(wchar_t* __s1, const wchar_t* __s2)
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\random:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stl_algo.h:66,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\algorithm:62,
from ./Box2D/Collision/b2BroadPhase.h:25,
from C:/Users/Michael/Documents/temp/ncrv3/Box2D/Collision/b2BroadPhase.cpp:19:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:177:11: error: '::wcscat' has not been declared
using ::wcscat;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:178:11: error: '::wcscmp' has not been declared
using ::wcscmp;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:179:11: error: '::wcscoll' has not been declared
using ::wcscoll;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\string:40:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\random:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stl_algo.h:66,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\algorithm:62,
from ./Box2D/Collision/b2BroadPhase.h:25,
from ./Box2D/Dynamics/b2ContactManager.h:22,
from ./Box2D/Dynamics/b2World.h:25,
from C:/Users/Michael/Documents/temp/ncrv3/Box2D/Dynamics/b2World.cpp:19:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h: In static member function 'static std::size_t std::char_traits<wchar_t>::length(const char_type*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:358:26: error: 'wcslen' was not declared in this scope
{ return wcslen(__s); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:180:11: error: '::wcscpy' has not been declared
using ::wcscpy;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:181:11: error: '::wcscspn' has not been declared
using ::wcscspn;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:183:11: error: '::wcslen' has not been declared
using ::wcslen;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:184:11: error: '::wcsncat' has not been declared
using ::wcsncat;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:185:11: error: '::wcsncmp' has not been declared
using ::wcsncmp;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:186:11: error: '::wcsncpy' has not been declared
using ::wcsncpy;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:188:11: error: '::wcsspn' has not been declared
using ::wcsspn;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:193:11: error: '::wcstok' has not been declared
using ::wcstok;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:196:11: error: '::wcsxfrm' has not been declared
using ::wcsxfrm;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:204:11: error: '::wcschr' has not been declared
using ::wcschr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:205:11: error: '::wcspbrk' has not been declared
using ::wcspbrk;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:206:11: error: '::wcsrchr' has not been declared
using ::wcsrchr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:207:11: error: '::wcsstr' has not been declared
using ::wcsstr;
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:213:55: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:212:3: note: initializing argument 1 of 'wchar_t* std::wcschr(wchar_t*, wchar_t)'
wcschr(wchar_t* __p, wchar_t __c)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:217:58: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:216:3: note: initializing argument 1 of 'wchar_t* std::wcspbrk(wchar_t*, const wchar_t*)'
wcspbrk(wchar_t* __s1, const wchar_t* __s2)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:221:56: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:220:3: note: initializing argument 1 of 'wchar_t* std::wcsrchr(wchar_t*, wchar_t)'
wcsrchr(wchar_t* __p, wchar_t __c)
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar: In function 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:225:57: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:224:3: note: initializing argument 1 of 'wchar_t* std::wcsstr(wchar_t*, const wchar_t*)'
wcsstr(wchar_t* __s1, const wchar_t* __s2)
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\string:40:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\random:40,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stl_algo.h:66,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\algorithm:62,
from ./Box2D/Collision/b2BroadPhase.h:25,
from C:/Users/Michael/Documents/temp/ncrv3/Box2D/Collision/b2BroadPhase.cpp:19:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h: In static member function 'static std::size_t std::char_traits<wchar_t>::length(const char_type*)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h:358:26: error: 'wcslen' was not declared in this scope
{ return wcslen(__s); }
^
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Collision/b2CollideCircle.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Collision_b2CollideCircle.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Collision/b2CollideEdge.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Collision_b2CollideEdge.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
C:/MinGW/bin/g++.exe -c "C:/Users/Michael/Documents/temp/ncrv3/Box2D/Collision/b2CollidePolygon.cpp" -g -O0 -Wall -std=c++11 -DSFML_STATIC -o ./Debug/Box2D_Collision_b2CollidePolygon.cpp.o -I. -IC:\Users\Michael\Documents\SFML\SFML-2.4.1\include
mingw32-make.exe[1]: *** [Debug/Box2D_Collision_b2BroadPhase.cpp.o] Error 1
mingw32-make.exe[1]: *** Waiting for unfinished jobs....
ncrv3.mk:190: recipe for target 'Debug/Box2D_Collision_b2BroadPhase.cpp.o' failed
ncrv3.mk:174: recipe for target 'Debug/Box2D_Dynamics_b2World.cpp.o' failed
mingw32-make.exe[1]: *** [Debug/Box2D_Dynamics_b2World.cpp.o] Error 1
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/Michael/Documents/temp/ncrv3'
Makefile:4: recipe for target 'All' failed
====1 errors, 8 warnings====
I managed to solve my problem, but it's more of a workaround than an actual fix. All functionality is restored by switching from -std=c++11 to -std=gnu++11. So if you have a similar problem, try switching.
I recently downloaded a program. A patient specific survival prediction CLI, http://pssp.srv.ualberta.ca/
The readme included states:
"1 Compilation
The code should compile on Linux without any modification. To compile, just type ’make’. There should
be 2 executables after compilation, mtlr train and mtlr test."
I download an extracted the folder to my location, when I go into the directory and type make I get:
x#x-laptop:/pssp_source$ make
g++ -c -O3 DenseVector.cpp -o DenseVector.o
In file included from DenseVector.cpp:1:0:
DenseVector.h:9:2: error: ‘size_t’ does not name a type
size_t m_dim;
^
DenseVector.h:18:21: error: expected ‘)’ before ‘n’
DenseVector(size_t n);
^
DenseVector.h:26:33: error: ‘size_t’ does not name a type
double const& operator[](const size_t i) const
^
DenseVector.h:26:40: error: ISO C++ forbids declaration of ‘i’ with no type [-fpermissive]
double const& operator[](const size_t i) const
^
DenseVector.h:31:27: error: ‘size_t’ does not name a type
double& operator[](const size_t i)
^
DenseVector.h:31:34: error: ISO C++ forbids declaration of ‘i’ with no type [-fpermissive]
double& operator[](const size_t i)
^
DenseVector.h:38:2: error: ‘size_t’ does not name a type
size_t dim() const
^
DenseVector.h: In member function ‘void DenseVector::push_back(double)’:
DenseVector.h:23:3: error: ‘m_dim’ was not declared in this scope
m_dim++;
^
DenseVector.cpp: At global scope:
DenseVector.cpp:6:1: error: prototype for ‘DenseVector::DenseVector(size_t)’ does not match any in class ‘DenseVector’
DenseVector::DenseVector(size_t n): m_dim(n)
^
In file included from DenseVector.cpp:1:0:
DenseVector.h:5:7: error: candidates are: DenseVector::DenseVector(const DenseVector&)
class DenseVector
^
DenseVector.h:12:2: error: DenseVector::DenseVector()
DenseVector(void);
^
DenseVector.cpp: In constructor ‘DenseVector::DenseVector()’:
DenseVector.cpp:16:2: error: class ‘DenseVector’ does not have any field named ‘m_dim’
:m_dim(0)
^
DenseVector.cpp: In member function ‘void DenseVector::clear()’:
DenseVector.cpp:27:22: error: ‘m_dim’ was not declared in this scope
for (size_t i=0; i<m_dim; i++)
^
In file included from /usr/include/c++/4.8/cassert:43:0,
from DenseVector.cpp:3:
DenseVector.cpp: In function ‘double sprod_nn(const DenseVector&, const DenseVector&)’:
DenseVector.cpp:37:11: error: ‘const class DenseVector’ has no member named ‘dim’
assert(a.dim() == b.dim());
^
DenseVector.cpp:37:22: error: ‘const class DenseVector’ has no member named ‘dim’
assert(a.dim() == b.dim());
^
DenseVector.cpp:38:15: error: ‘const class DenseVector’ has no member named ‘dim’
size_t n = a.dim();
^
In file included from /usr/include/c++/4.8/cassert:43:0,
from DenseVector.cpp:3:
DenseVector.cpp: In function ‘void multadd_nn(DenseVector&, const DenseVector&, double)’:
DenseVector.cpp:49:11: error: ‘class DenseVector’ has no member named ‘dim’
assert(w.dim()==a.dim());
^
DenseVector.cpp:49:20: error: ‘const class DenseVector’ has no member named ‘dim’
assert(w.dim()==a.dim());
^
DenseVector.cpp:50:15: error: ‘class DenseVector’ has no member named ‘dim’
size_t n = w.dim();
^
DenseVector.cpp: In function ‘void smult_n(DenseVector&, double)’:
DenseVector.cpp:62:15: error: ‘class DenseVector’ has no member named ‘dim’
size_t n = w.dim();
^
make: *** [DenseVector.o] Error 1
The contents of the folder look like:
x#x-laptop:/pssp_source$ ls
common.cpp data_type_api.h DenseVector.h Main.cpp Makefile Sparm.cpp Sparm.o SparseVector.h test_model.mltr Util.h
common.h DenseVector.cpp example_data Main.o readme.pdf Sparm.h SparseVector.cpp Test.cpp test_model.mlty
I looked up the basic packages needed for compiling c++ code, as well as basics on how to run it and none have gotten me past this issue. It looks as if it has a problem with size_t not having a type.
The start of DenseVector.cpp is :
#include "DenseVector.h"
#include <cassert>
#include <iostream>
DenseVector::DenseVector(size_t n): m_dim(n)
{
m_dvector.reserve(n);
for (size_t i=0; i<n; i++)
{
m_dvector.push_back(0);
}
}
I have never compiled code like this before, so I am probably missing something obvious. If its needed I am running ubuntu 14.04, g++ version is
4.8.4.
Thanks
It sounds like the README lied. Probably it happened to work with a different version of the standard library.
Try adding
#include <stddef.h>
near the top of DenseVector.h.
Open the file DenseVector.h in the root directory of the program and modify it, inserting
#pragma once
#include <vector>
#include <cstddef> // <--- Add this line to the file
class DenseVector
{
protected:
// ...
Save it and try again!
I don't think you are using the correct version of C; I think you need C11. Instead of using the -03 flag, use -11 or -std=c11. Then recompile it.
I'm trying to compile the lib ARvrml (From ARToolKit. See the source here) on Ubuntu and get this:
g++ -c -I../../../include -I/usr/local/include/openvrml -I/usr/X11R6/include -O -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml2 -I/usr/X11R6/include arViewer.cpp -o arViewer.o
In file included from arViewer.cpp:37:0:
arViewer.h:74:12: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.h:85:13: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.h:90:13: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.h:97:13: error: ‘object_t’ in ‘class openvrml::gl::viewer’ does not name a type
arViewer.cpp: In constructor ‘arVrmlBrowser::arVrmlBrowser()’:
arViewer.cpp:41:71: error: no matching function for call to ‘openvrml::browser::browser(std::ostream&, std::ostream&)’
arViewer.cpp:41:71: note: candidates are:
/usr/local/include/openvrml/openvrml/browser.h:284:9: note: openvrml::browser::browser(openvrml::resource_fetcher&, std::ostream&, std::ostream&)
/usr/local/include/openvrml/openvrml/browser.h:284:9: note: candidate expects 3 arguments, 2 provided
/usr/local/include/openvrml/openvrml/browser.h:195:24: note: openvrml::browser::browser(openvrml::browser&)
/usr/local/include/openvrml/openvrml/browser.h:195:24: note: candidate expects 1 argument, 2 provided
arViewer.cpp: At global scope:
arViewer.cpp:269:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
arViewer.cpp:283:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
arViewer.cpp:292:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
arViewer.cpp:305:1: error: ‘object_t’ in ‘class openvrml::viewer’ does not name a type
make: *** [arViewer.o] Error 1
Considering that ARToolkit (without VRML support) is working well and OpenVRML is installed successfully, I can't figure out what is the problem here.
I am trying to modify a C++ program by including POCO to be able to do a HTTP request and receive a result. Basically, I just need within another C++ program to give a username and password and get a plain "OK" or "ERROR" response.
I am not familiar with C++ at all (use Java mainly). I build the POCO project and installed it without any problems, but when I add it to the project I get a while pile of compiler errors when building:
In file included from ../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:30:
In file included from /usr/local/include/Poco/Net/HTTPClientSession.h:44:
In file included from /usr/local/include/Poco/Net/HTTPSession.h:44:
In file included from /usr/local/include/Poco/Net/StreamSocket.h:44:
In file included from /usr/local/include/Poco/Net/Socket.h:44:
In file included from /usr/local/include/Poco/Net/SocketImpl.h:47:
In file included from /usr/local/include/Poco/Timespan.h:44:
/usr/local/include/Poco/Timestamp.h:50:1: error: declaration of anonymous class must be a definition
class Foundation_API Timestamp
^
/usr/local/include/Poco/Timestamp.h:149:24: error: expected identifier
inline bool Timestamp::operator == (const Timestamp& ts) const
^
/usr/local/include/Poco/Timestamp.h:149:13: error: declaration of anonymous struct must be a definition
inline bool Timestamp::operator == (const Timestamp& ts) const
^
../crtmpserver/sources/common/include/platform/osx/osxplatform.h:109:19: note: expanded from macro 'Timestamp'
#define Timestamp struct tm
^
In file included from ../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:30:
In file included from /usr/local/include/Poco/Net/HTTPClientSession.h:44:
In file included from /usr/local/include/Poco/Net/HTTPSession.h:44:
In file included from /usr/local/include/Poco/Net/StreamSocket.h:44:
In file included from /usr/local/include/Poco/Net/Socket.h:44:
In file included from /usr/local/include/Poco/Net/SocketImpl.h:47:
In file included from /usr/local/include/Poco/Timespan.h:44:
/usr/local/include/Poco/Timestamp.h:262:1: error: expected unqualified-id
} // namespace Poco
^
In file included from ../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:30:
In file included from /usr/local/include/Poco/Net/HTTPClientSession.h:44:
In file included from /usr/local/include/Poco/Net/HTTPSession.h:44:
In file included from /usr/local/include/Poco/Net/StreamSocket.h:44:
In file included from /usr/local/include/Poco/Net/Socket.h:44:
In file included from /usr/local/include/Poco/Net/SocketImpl.h:47:
/usr/local/include/Poco/Timespan.h:54:21: error: no struct named 'TimeDiff' in 'tm'
typedef Timestamp::TimeDiff TimeDiff;
~~~~~~~~~~~^
In file included from ../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:30:
In file included from /usr/local/include/Poco/Net/HTTPClientSession.h:44:
In file included from /usr/local/include/Poco/Net/HTTPSession.h:47:
/usr/local/include/Poco/Any.h:123:46: error: cannot use typeid with -fno-rtti
return _content ? _content->type() : typeid(void);
^
/usr/local/include/Poco/Any.h:149:20: error: cannot use typeid with -fno-rtti
return typeid(ValueType);
^
/usr/local/include/Poco/Any.h:180:42: error: cannot use typeid with -fno-rtti
return operand && operand->type() == typeid(ValueType)
^
In file included from ../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:30:
/usr/local/include/Poco/Net/HTTPClientSession.h:291:8: error: expected member name or ';' after declaration specifiers
Poco::Timestamp _lastRequest;
~~~~ ^
../crtmpserver/sources/common/include/platform/osx/osxplatform.h:109:19: note: expanded from macro 'Timestamp'
#define Timestamp struct tm
^
../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:94:10: error: expected expression
form.add(<D2>entry1<D3>, <D2>value1<D3>);
^
../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:97:25: error: variable has incomplete type 'Poco::Net::HTTPResponse'
Poco::Net::HTTPResponse response;
^
/usr/local/include/Poco/Net/HTTPClientSession.h:55:7: note: forward declaration of 'Poco::Net::HTTPResponse'
class HTTPResponse;
^
../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:99:41: error: no member named 'cout' in namespace 'std'; did you mean 'count'?
Poco::StreamCopier::copyStream(rs, std::cout);
~~~~~^~~~
count
/usr/include/c++/4.2.1/bits/stl_algo.h:424:5: note: 'count' declared here
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
^
../crtmpserver/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp:99:36: error: address of overloaded function 'count' does not match required type 'std::basic_ostream<char>'
Poco::StreamCopier::copyStream(rs, std::cout);
^~~~~~~~~
/usr/include/c++/4.2.1/bits/stl_algo.h:424:5: note: candidate function
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
^
/usr/local/include/Poco/StreamCopier.h:57:73: note: passing argument to parameter 'ostr' here
static std::streamsize copyStream(std::istream& istr, std::ostream& ostr, std::size_t bufferSize = 8192);
^
13 errors generated.
make[2]: *** [applications/idomsconnector/CMakeFiles/idomsconnector.dir/Users/[...]/sources/applications/idomsconnector/src/rtmpappprotocolhandler.cpp.o] Error 1
make[1]: *** [applications/idomsconnector/CMakeFiles/idomsconnector.dir/all] Error 2
make: *** [all] Error 2
build failed
My code fragment is as follows:
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTMLForm.h>
#include <Poco/StreamCopier.h>
string RTMPAppProtocolHandler::GetAuthPassword(string user) {
INFO("Testing auth: %s", STR(user));
Poco::Net::HTTPClientSession s("www.somehost.com");
//s.setProxy("localhost", srv.port());
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/large");
Poco::Net::HTMLForm form;
form.add(“entry1”, “value1”);
form.prepareSubmit(request);
s.sendRequest(request);
Poco::Net::HTTPResponse response;
std::istream& rs = s.receiveResponse(response);
Poco::StreamCopier::copyStream(rs, std::cout);
return user;
}
Am I doing something stupid? It is only this little interaction with a HTTP server which I need to modify, so I am just looking for a very simple solution but find it hard to find something that works easy (mainly because I am not familiar with C++ though)