Poprzedni temat udało mi się wyjaśnić. Rzeczywiście brakowała main-a
Ale też nie miałem podpiętego ws2_32:
tak więc poprzedni kod już działa:
język c
Musisz się zalogować, aby zobaczyć kod źródłowy. Tylko zalogowani użytkownicy mogą widzieć kod.
Działa zgodnie z sugestią
autoraMam natomiast problem z kolejnym, który już skompilować się nie chce:
język c
Musisz się zalogować, aby zobaczyć kod źródłowy. Tylko zalogowani użytkownicy mogą widzieć kod.
Z tym coś jest nie tak:
język c
Musisz się zalogować, aby zobaczyć kod źródłowy. Tylko zalogowani użytkownicy mogą widzieć kod.
Build messages:
Kod:
||=== Build: Debug in COM_read_with_timeout_second_code (compiler: GNU GCC Compiler) ===|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\boost\asio\detail\config.hpp|566|warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\boost\asio\detail\config.hpp|567|warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\boost\asio\detail\config.hpp|568|warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]|
D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp||In function 'std::string read_response()':|
D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp|33|error: no matching function for call to 'std::exception::exception(const char [16])'|
D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp|33|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\exception|65|note: std::exception::exception()|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\exception|65|note: candidate expects 0 arguments, 1 provided|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\exception|62|note: std::exception::exception(const std::exception&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\exception|62|note: no known conversion for argument 1 from 'const char [16]' to 'const std::exception&'|
||=== Build failed: 1 error(s), 3 warning(s) (0 minute(s), 1 second(s)) ===|
Build log:
Kod:
-------------- Build: Debug in COM_read_with_timeout_second_code (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -c D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp -o obj\Debug\main.o
In file included from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/boost/asio/serial_port.hpp:19:0,
from D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp:3:
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/boost/asio/detail/config.hpp:566:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/boost/asio/detail/config.hpp:567:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include/boost/asio/detail/config.hpp:568:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp: In function 'std::string read_response()':
D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp:33:41: error: no matching function for call to 'std::exception::exception(const char [16])'
D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp:33:41: note: candidates are:
In file included from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/new:42:0,
from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/ext/new_allocator.h:34,
from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/mingw32/bits/c++allocator.h:34,
from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/bits/allocator.h:48,
from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/string:43,
from D:\Mariusz\Zapisane\Programowanie\COM_read_with_timeout_second_code\main.cpp:1:
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/exception:65:5: note: std::exception::exception()
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/exception:65:5: note: candidate expects 0 arguments, 1 provided
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/exception:62:9: note: std::exception::exception(const std::exception&)
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/exception:62:9: note: no known conversion for argument 1 from 'const char [16]' to 'const std::exception&'
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 3 warning(s) (0 minute(s), 1 second(s))