News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Not sure whos fault is this

Started by smallB, December 03, 2012, 05:06:32 PM

Previous topic - Next topic

smallB

Guys, the code below causes msg with info that SIGSEGV occured etc. The point is that the same code compiles fine with the same compiler but with different IDE (Qt),so I thought I let you know that when code::blocks is used something is going pairshaped ;) :
#include <iostream>
#include <string>
#include <algorithm>
using std::cout;



std::string encode(const std::string& decoded)
{
   std::string encoded_url(decoded);//SIGSEGV_E this line causes signal SIGSEGV
   typedef typename std::string::iterator iterator;
   for (iterator i = encoded_url.begin();(i = std::find(i,encoded_url.end(),'%')) != encoded_url.end();++i)        {
       cout << *i << *(i + 1) << *(i + 2) << '\n';
   }
   return encoded_url;
}
int main()
{
   std::string decoded_url("http%3A%2F%2Fo-o---preferred---sn-xn5ucu-q0ce---v20---lscache7.c.youtube.com%2Fvideoplayback%3Fupn%3DQfNLYnp9JHM%26sparams%3Dcp%252Cgcr%252Cid%252Cip%252Cipbits%252Citag%252Cratebypass%252Csource%252Cupn%252Cexpire%26fexp%3D907724%252C923009%252C914070%252C916626%252C922401%252C920704%252C912806%252C927201%252C925703%252C925706%252C928001%252C922403%252C913546%252C913556%252C920201%252C911116%252C901451%26ms%3Dau%26expire%3D1354491207%26itag%3D43%26ipbits%3D8%26gcr%3Die%26sver%3D3%26ratebypass%3Dyes%26mt%3D1354467611%26ip%3D89.204.226.98%26mv%3Dm%26source%3Dyoutube%26key%3Dyt1%26cp%3DU0hUSVRUT19FUUNONF9MTlNDOm05Ql9HWWNIejNM%26id%3Dcaf9021d49b11ad9%26newshard%3Dyes&type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22&fallback_host=tc.v1.cache5.c.youtube.com&sig=63E945F5FCC5744AFDA6A473D2B7D3A464DC56AE.31AF09E39FFF100E5A5066418689DA3DD4D78C37&quality=medium");
   cout << encode(decoded_url);
   return 0;
}

stahta01

#1
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Edit: You need to verify the compiler and linker commands match or at least closely match.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]