Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rizaado

Pages: [1]
1
Network / Re: undefined reference
« on: November 07, 2014, 01:30:06 pm »
How can I repair this errors and use network in sfml without problems?

2
Network / undefined reference
« on: November 07, 2014, 12:43:40 pm »
Hello. I  read the documentation(Connecting a TCP socket) and this is my code:

#include <SFML/Network.hpp>

using namespace std;

int main()
{
    sf::TcpSocket socket;
    sf::Socket::Status status = socket.connect("192.168.0.5", 53000);
    if (status != sf::Socket::Done)
    {
        // error...
    }
    return 0;
}
 

The Debug said:

||=== Build: Debug in chat (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\Emil\Desktop\C++\chat\main.cpp|7|undefined reference to `_imp___ZN2sf9TcpSocketC1Ev'|
C:\Users\Emil\Desktop\C++\chat\main.cpp|8|undefined reference to `_imp___ZN2sf9IpAddressC1EPKc'|
C:\Users\Emil\Desktop\C++\chat\main.cpp|8|undefined reference to `_imp___ZN2sf4Time4ZeroE'|
C:\Users\Emil\Desktop\C++\chat\main.cpp|8|undefined reference to `_imp___ZN2sf9TcpSocket7connectERKNS_9IpAddressEtNS_4TimeE'|
obj\Debug\main.o||In function `ZN2sf9TcpSocketD1Ev':|
C:\SFML-2.1\include\SFML\Network\TcpSocket.hpp|46|undefined reference to `_imp___ZTVN2sf9TcpSocketE'|
C:\SFML-2.1\include\SFML\Network\TcpSocket.hpp|46|undefined reference to `_imp___ZN2sf6SocketD2Ev'|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

I have the newest version of codeblocks:codeblocks-13.12mingw-setup-TDM-GCC-481.exe

What can I do to run the code?

3
Thank you wintertime and everybody who wrote it this topic. I reinstalled the whole IDE with TDM-GCC-481 and it worked.

4
I am with windows 7, codeblocks, GNU GCC Compiler. I have seen that there are more people that have the same problem as mine. From codeblocks but I can`t turn on C++11. I checked it true from Settings->Compiler and from project->Build Options but it messages:

thread is not member of std

This is for example the code:
// thread example
#include <iostream>       // std::cout
#include <thread>         // std::thread
 
void foo()
{
  // do stuff...
}

void bar(int x)
{
  // do stuff...
}

int main()
{
  std::thread first (foo);     // spawn new thread that calls foo()
  std::thread second (bar,0);  // spawn new thread that calls bar(0)

  std::cout << "main, foo and bar now execute concurrently...\n";

  // synchronize threads:
  first.join();                // pauses until first finishes
  second.join();               // pauses until second finishes

  std::cout << "foo and bar completed.\n";

  return 0;
}

The administrator of codeblocks` forum said and you can see more here - http://forums.codeblocks.org/index.php?topic=17838.0;prev_next=prev:
Quote
We do not build vompilers just an IDE, that works with many compilers.
We ship with a TDM's gcc on windows to make it easy to start coding for beginners (and most other users) without the need to explicitely download a compiler.
So you as user are free to use any supported compiler, with or without std:thread-support.

He answered to someone who said:
Quote
oh my bad Sad that's really freaking. Ok I have than to swap to Linux partition.
is there any chance to add support for std::thread ever in GCC at this point?

What can I do to change my compiler or?

5
Hello. I am wondering is this possible to pass parameter or argument`s address and get it with reference operator or with pointer in thread's function which is in class with SFML System Class. Can I send the value of argument too? I have read that is better to use C++ ISO 11. Is there something new with threads in C++ ISO 14?
Something like this:
#include <SFML/System.hpp>
#include <iostream>
using namespace std;
class MyClass
{
public:

    void func(int & argument or int * argument or int argument)
    {
//make something with this argument for example ++argument or ++*argument or print it with cout  
    }
};
int main()
{
int argument = 0;

MyClass object;
sf::Thread thread(&MyClass::func, &object, (argument or &argument or argument  ));
thread.launch();
return 0;
}
 
Thank you. Have a nice day.

Pages: [1]
anything