I am working on a project that is written is VScode and is working properly. But when I am trying to execute the same on gn(generate ninja), this the error I am getting:-
error: no member named 'GetLength' in 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>'
int sz = string.GetLength();
I am not sure what is wrong here. Any little hint will be highly appreciated.
Related
I am using libsndfile and portaudio to play audio from a .wav file and I am getting some weird undefined reference (in time.h...?) errors upon use of sf_open(const char*, int, SF_INFO*) Before showing the errors, here is some basic info: I'm using MinGW 3.21 (cannot upgrade due to IDE constraints) on Windows 10, with CMake as my build system. I have verified that the const char* passed to sf_open is a valid file name and I have checked that no other lines of code are causing this compilation error. Without further ado, have some lovely errors:
libsndfile/lib/libsndfile.a(aiff.o): In function time':
c:/dwimperl/c/bin/../lib/gcc/i686-w64-mingw32
/4.4.7/../../../../i686-w64-mingw32/include/time.h:242:
undefined reference to _time32'
This is printed several times, probably because the function time is used a lot in sf_open although I haven't a clue as to why. This happens as well:
In function `gmtime':
c:/dwimperl/c/bin/../lib/gcc/i686-w64-
mingw32/4.4.7/../../../../i686-w64-mingw32/include/time.h:240:
undefined reference to `_gmtime32'
These errors imply no correlation between sf_open and time.h, but I even tried the following,
#include<sndfile.h>
int main {
sf_open(nullptr, 0, nullptr);
return 0;
}
and gotten the same result. I have libsndfile-1.dll in the same directory as my compiled binaries, and am linking to both libsndfile.a and libsndfile.dll.a. I have tried only linking to libsndfile.a with the same result. However, I tried linking only to libsndfile.dll.a and the program compiled but then crashed, saying:
An error occured while using the portaudio stream
Error number: -9984
Error message: Incompatible host API specific stream info
I'm not sure whether or not that is something for another question, but I thought I'd mention it, seeing that sf_open, the faulty function, seems to do something with stream info. Anyways, this is as far as I've gotten. Help is appreciated!
Look at me being such a genius, answering the question by asking it and then not noticing. Sometimes I wonder how I'm still alive. Anyways, it was simple. Don't link libsndfile.a, just libsndfile.dll.a. That's all. The PortAudio error was something entirely unrelated. Sorry for the idiocy, hope this helps at least one person...?
My aunt gave me a book about c++ (for beginners). It's nice and so I wanted to test one of those code samples. But I am just getting errors. I didn't find anything that could help me on Google or so.
I am using Eclipse Mars.1 C++ and MinGW.
Code:
/*
* Erstes_Programm.cpp
*
* Created on: 26.12.2015
* Author: Luca
*/
// Erstes Programm
#include <iostream>
using namespace std;
int main() {
cout << "It's just a test!" << endl;
return 0;
}
I am getting those errors:
Using namespace:
Description Resource Path Location Type
expected ';' before ':' token
Erstes_Programm.cpp /Programmieren C++ (Einführung)
line 10
C/C++ Problem
AND
Description Resource Path Location Type
expected unqualified-id before ':' token
Erstes_Programm.cpp /Programmieren C++ (Einführung)
line 10
C/C++ Problem
Hope somebody can help me?
Here is a screenshot:
EDIT: PROBLEM SOLVED!! I don't know WHAT I did, but it's solved I'm not getting any errors and everything works perfectly. Thanks for everybody who wanted to help
The first line in the screenshot doesn't make any sense. Remove it. The rest looks fine. And in the future, post text, not screenshots.
Instead work on X-code rather then eclipse for C++. Visual studio is most recommend.
For Your problem, I think you got to play with the library, something must not be supported, other then that your code look fine.
Ok so I'm using CodeBlocks for programming in C++ . I have so "random" (it doesn't happen everytime, and I'm not able to predict when it happens) error message which makes the program crash, it says :
Assertion 't = find_next_time_event( m )' failed at pulse/mainloop.c:721,
function calc_next_timeout() . Aborting .
Aborted (core dumped) .
Process returned 134 (0x86)
Core dumped is when I should not have deleted some pointer, am I right?
The thing I don't understand is what is before "Aborted, core dumepd" . Can it guide me to which kind of error I made ?
Or is it a problem with CodeBlocks (I doubt it , but that could be great :p)
*I don't put code here because I just want information about what could theorically create this kind of message . Then I'll search and if I've problems with finding the error(s), I'll put some code here ;) *
It is telling you that an assertion failed on line 721 of the file pulse/mainloop.c that is part of your source code.
An assertion is typically placed to check invariants or preconditions/postconditions. Taking a precondition as an example, this is saying "this expression has to be true in order for the code below to work correctly".
By inspecting the condition (at line 721 of mainloop.c) and understanding why it was not true in your case, you should be able to find an error in your code that lead to the failed assertion.
This isn't really a solution but this issue actually has to do with PulseAudio. I assume OP is using Linux, possibly Ubuntu, which is when this error occurs. I sometimes get the same thing when using a program written in Python. There is a noted bug about this issue in the PulseAudio Launchpad bugs.
I am trying to modify an old MFC program. After opening the project in Visual Studio 2013 there are many errors of the type below.
In AviPlay.cpp
#include "stdafx.h"
#include "AviPlay.h"
#define OPEN_AVI_VIDEO "open avivideo"
BOOL initAVI()
{
return mciSendString(OPEN_AVI_VIDEO, NULL, 0, NULL) == 0;
}
The error thrown is error C2664: 'MCIERROR mciSendStringW(LPCWSTR,LPWSTR,UINT,HWND)' : cannot convert argument 1 from 'const char [14]' to 'LPCWSTR'
Should setting the compiler option for Strict to off, or some other compiler option, resolve this error? If not, I can modify the many lines of code manually. In that case, what might have changed in the last 15 years that would make code like this OK before but not OK now?
Thank you in advance.
LPCWSTR tells you it is expecting a wchar_t string, not a char string. By default, all Windows APIs now accept wchar_t strings (unicode). You can change it back to char strings in the project properties, General page, Character Set. Setting it to 'Use Multibyte char set' will get it working as it used to.
Also if you are creating a new project and facing this issue , then make the conformance mode to Default or No .
My VC++ code was working (executing) perfectly alright & now all of a sudden I don't understand why am I getting the error "Debug assertion failed".
file:f\dd\vctools\crt_bld\self_x86\crt\src\fclose.c.
I am using VS2008 on WIn7 64bit OS.
What might be the reason that a code which was working fine started breaking in this manner all of a sudden without any code changes?
Can anyone kindly help me in getting rid of this error?
I saw in the call stack that the code before this is in the file
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\crt\src\crt0dat.c
while ( pfbegin < pfend )
{
/*
* if current table entry is non-NULL, call thru it.
*/
if ( *pfbegin != NULL )
(**pfbegin)();
++pfbegin;
}
And yes, fclose() is receiving a null file pointer. I seriously don't understand why is this getting wrong file pointer value, all of a sudden without me doing any change to the code or to the environment.
Could you provide the code which calls fclose()?
I may guess that fopen() failed to open the file returning NULL, e.g. because file doesn't exist. You didn't check for this error and passed NULL handle to fclose().