codeblocks

Enabling `-std=c++14` flag in Code::Blocks

北城余情 提交于 2019-12-17 23:24:00
问题 I have installed Code::Blocks for Windows and want to compile C++14 code like generic lambdas but the binary version of Code::Blocks that I've installed from codeblocks.org doesn't support the flag -std=c++14 . How do I update the compiler and enable -std=c++14 flag for Code::Blocks? 回答1: To compile your source code using C++14 in Code::Blocks, you, first of all, need to download and install a compiler that supports C++14 features. Here’s how you can do it on Windows: Download MinGW from here

Static-linking of SDL2 libraries

别等时光非礼了梦想. 提交于 2019-12-17 22:16:50
问题 I am using Windows 7, Code::Blocks and MinGW. I have little to no experience when it comes to compiling/building anything, especially when Code::Blocks doesn't use makefiles. I downloaded SDL2-devel-2.0.0-mingw.tar.gz (SDL Development Libraries) from http://www.libsdl.org/tmp/download-2.0.php, and I'd like to create a standalone executable using SDL2 libraries, but so far I've always had to bundle the SDL2.dll file with the executable to make it work. I've heard that I can not static-link

How to use C11 standard in Code::Blocks

匆匆过客 提交于 2019-12-17 21:59:37
问题 Like the Title says I need to make code::blocks to work with C11 and I can't figure out how to do it. I went to settings => compiler settings => Other options and I added -std=c11 and tried also with -std=gnu11 , both doesn't seems to work. I compiled gcc-5.2 and then I changed the default compiler (gcc-4.9) and still no result. When I try to compile the following program: #include<stdio.h> int main(void){ int arr[] = {0,1,2,3,4}; for(int i=0;i<5;i++){ printf("%d ",arr[i]); } return 0; } I

C++:Undefined reference to 'FMOD:: X'

走远了吗. 提交于 2019-12-17 20:39:11
问题 After looking around for various sound API libraries, I have decided to use FMOD for the time being. Problem is that whenever I try to compile one of the code examples, I get the following errors: obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::getVersion(unsigned int*)@8'| obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::init(int, unsigned int, void*)@16'| obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::createSound(char const*,

C++ linux: dlopen can't find .so library

人走茶凉 提交于 2019-12-17 19:06:47
问题 Reworded Question (although it's been solved already): I've been having trouble using dlopen(3) to load a shared object library on linux. The library is part of a system of libraries built by me that are all loaded at runtime by a central executable. All of this is organized into a single workspace in Code::Blocks, where each project is given its own folder within a directory called Source, which is to be shipped with the program. The build directory of the executable is two directories

How do I compile for 64bit using G++ w/ CodeBlocks?

↘锁芯ラ 提交于 2019-12-17 18:24:36
问题 I'm currently working on creating a shared lib DLL but I need to load it at runtime in a 64 bit environment so it currently doesn't work. How can I compile 64bit dlls from code blocks using g++ ? I've tried compiler options like -m64 but none seem to work. 回答1: To compile 64-bit programs on windows using g++, you need MinGW64. I believe that Code::Blocks comes with MinGW32. To install it onto Code::Blocks, extract the zip file to a folder without spaces, such as C:\MinGW64 Open Code::Blocks

How to get ride of console box of a GUI program compile by MinGW + Code::Block

◇◆丶佛笑我妖孽 提交于 2019-12-17 16:40:09
问题 When I compile and run a simple Win32 GUI program in MinGW+MSys with command line: $ g++ main.cpp -o app -std=c++0x $ ./app only a dialog box shows. But when I put this program into Code::Blocks IDE and compile it, it always results in a black console box with the dialog. Adding -mwindows in link options no effect. main.cpp: #include <windows.h> int WinMain(HINSTANCE,HINSTANCE,LPSTR,int) { MessageBox(0,"Hello, Windows","MinGW Test Program",MB_OK); return 0; } How can I get rid of the console

C++ Pixels In Console Window

蓝咒 提交于 2019-12-17 15:38:14
问题 In C++ using Code::Blocks v10.05, how do I draw a single pixel on the console screen? Is this easy at all, or would it be easier to just draw a rectangle? How do I color it? I'm sorry, but I just can't get any code from SOF, HF, or even cplusplus.com to work. This is for a Super Mario World figure on the screen. The game I think is 16-bit, and is for the SNES system. C::B says I need SDK for C::B. It says "afxwin.h" doesn't exist. Download maybe? This is what I'm trying to make: 回答1: It

ld.exe: cannot open output file … : Permission denied

为君一笑 提交于 2019-12-17 15:28:07
问题 I recently installed CodeBlocks with mingw32 on Windows 7 Ultimate 32bit in order to dust off my c skills, but this problem has me somewhat stumped. I decided to fire off a short Fibonacci generator to make sure my setup was working, but I ran into a hurdle. The program compiles, links and whatnot like a charm and I get a corresponding executable which runs as expected. The problems occur if I try to compile again, then I get the following: c:/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../

C++: Where does the ofstream class save the files to?

 ̄綄美尐妖づ 提交于 2019-12-17 09:58:07
问题 I moved from Windows to Mac and now I'm experiencing a problem with the file input/output classes: ifstream & ofstream . In Windows when you run with g++/Code Blocks ofstream out("output.txt"); out << "TEST"; out.close(); A new file "output.txt" will be created in the same directory. However in MAC OS X, this file is created in my home directory: /Users/USER_NAME/output.txt How can I have this file in the same directory together with the executable? P.S. I'm using GCC and CodeBlocks. There