我的项目在C中,CodeBlocks是我的IDE,我在Windows Vista上运行.我需要对我的数据应用巴特沃斯滤波器.我可以使用Matlab自动执行此操作,因为它将此(和其他)Filter作为内置函数.计算机和编程并不完全是我的领域,我从来没有"导入"新的库,也不知道如何做到这一点.这很复杂吗?我会做什么最好的?编写Butterworth Filter的代码作为函数?或"导入"图书馆为我这样做?(就个人而言,如果不复杂,我更喜欢得到一个库,因为它可能还有其他类型的过滤器,我也可以测试)
我正在使用Code :: Blocks with MinGW在Windows XP中编写我的C++应用程序.现在我想编译我的代码在MS DOS环境下运行,所以我可以将它放在我的DOS格式化软盘上.谁能帮我?
提前致谢.
PS我的意思不是命令提示符,但真正的好旧的MS DOS操作系统.
我非常喜欢Code :: Blocks作为其构建系统并逐步调试功能 - 即我非常喜欢使用封装到gcc/gdb而不是使用Makefile或命令行.问题是,经过多年的VIM使用,我无法在大脑中受到损坏(或者有些人可能会说,而且我无法在标准的Windows文本编辑器中进行编辑).
因此,我设置Code :: Blocks以使用VIM作为.cpp / .c/*.h 的文件处理程序.以及VIM的--server-name和--remote-tab选项可以右键单击我的C中的文件: :B项目窗口并选择使用文件扩展名处理程序打开它们,它们在单个VIM窗口中弹出为新选项卡 - 然后我切换回C :: B,点击F9进行构建和运行等.
我想改进我的工作流程,所以问题有两个:
当我双击项目文件列表中的文件而不必右键单击 - >打开文件扩展名处理程序时,我可以默认使C :: B打开VIM吗?
我可以在VIM中进行一些绑定,这样我可以点击一个按钮并让Code :: Blocks构建/运行/调试我的项目吗?
WRT 2,我知道C :: B有重建项目的命令行选项,但这与打开C :: B窗口并看到编译日志/监视窗口不同.我还注意到C :: B有一个非常基本的DDE接口 - 我可以使用VIM发送DDE命令吗?也许有一个简单的SendKeys插件我还没发现我可以破解工作?
或者,是否有像C :: B这样的轻量级IDE,这使得使用外部编辑器非常容易?我不准备运行Eclipse,在Visual Studio中使用Microsoft的编译器让我感到尴尬.
任何帮助赞赏.
谢谢,约翰
当我使用命令行测试在MinGW + MSys中编译一个简单的Win32 GUI程序并运行它:
$ g ++ main.cpp -o app -std = c ++ 0x
$ ./app
只显示一个对话框.但是把这个程序放到Code :: Block IDE中并编译它,它带有一个带有对话框的黑色控制台盒.在链接选项中添加-mwindows无效.
main.cpp中
#include <windows.h>
int WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
MessageBox(0,"Hello, Windows","MinGW Test Program",MB_OK);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 这可能是一个愚蠢的问题,我发布这个后谷歌搜索,问题是,
How do i view the contents of an array while debugging, Provided the Breakpoint is in function not Main?
我正在使用code :: blocks 13.12版本,我在我的示例简单c ++代码中设置了一个断点,我想观察数组的内容如何随代码而改变,但我看到的只是观察下的数组的地址窗口, 然而它正确显示其他整数变量的值,

a是一个数组
我忘了提到我在函数中跟踪数组而不是在main中,我知道main将数组的地址传递给被调用的函数(通过引用我的意思)
我比较新的代码块,我错过了一些设置或什么?
我目前正在创建一个共享的lib DLL,但我需要在运行时在64位环境中加载它,所以它目前无法正常工作.
如何使用g ++从代码块编译64位dll?
我已经尝试过像-m64这样的编译器选项,但似乎没有工作.
解决了上一个问题后(请参阅我提出的另一个问题).我宣布了更多课程.
其中一个名为CombatAdmin,它可以执行各种操作:(头文件)
#ifndef COMBATADMIN_H
#define COMBATADMIN_H
#include <string> // Need this line or it complains
#include <Player.h>
#include <Sound.h>
#include <Enemy.h>
#include <Narrator.h>
using namespace std;
class Enemy;
class Player;
class CombatAdmin // Code yet to be commented here, will come soon.
{
public:
CombatAdmin();
void healthSet(double newHealth, string playerName);
void comAdSay(string sayWhat);
void playerFindsChest(Player *player,Weapon *weapon,Armour *armour);
void youStoleOurStuffEncounter(Player *player);
void comAdWarning(string enemyName);
void comAdAtkNote(string attack, double damage,string target,string aggresor);
void entDefeated(string entName);
void comAdStateEntHp(string ent, double hp);
void …Run Code Online (Sandbox Code Playgroud) 我最近决定尝试使用CodeBlocks 10.05处理SDL.我从http://www.sdltutorials.com/sdl-tutorial-basics上的教程开始,并尽力遵循它.不幸的是,我遇到了:
..\..\..\..\..\..\SDL\SDL-1.2.15\lib\libSDLmain.a(SDL_win32_main.o):SDL_win32_main.c|| undefined reference to `SDL_main'|
Run Code Online (Sandbox Code Playgroud)
当我尝试编译它.
我已经搜索了本网站上的许多问题和其他教程(主要是关于LazyFoo和CodeBlocks wiki的教程),似乎无法找到解决方案.
当试图按照CodeBlocks wiki上的教程进行操作时,我被告知在给定目录中找不到SDL.h(在创建新的SDL项目时).
CApp.cpp
#include "CApp.h"
#include "SDL\SDL.h"
CApp::CApp(){
Surf_Display=NULL;
Running=true;
}
int CApp::OnExecute(){
if (OnInit()==false){
return -1;
}
SDL_Event Event;
while (Running){
while (SDL_PollEvent(&Event)){
OnEvent(&Event);
}
OnLoop();
OnRender();
}
OnCleanup();
return 0;
}
int main(int argc, char* argv[]){
CApp theApp;
return theApp.OnExecute();
}
Run Code Online (Sandbox Code Playgroud)
CApp.h
#ifndef CAPP_H_INCLUDED
#define CAPP_H_INCLUDED
#include "SDL\SDL.h"
class CApp{
private:
bool Running;
SDL_Surface* Surf_Display;
public:
CApp();
int OnExecute(); …Run Code Online (Sandbox Code Playgroud) 我正在编写带有代码块的C ++程序,出于调试目的,我需要知道代码块的构建目标是否设置为“ DEBUG”或“ RELEASE”。
我已经试过了:
#ifdef DEBUG
printf("Debug-Message");
#endif
Run Code Online (Sandbox Code Playgroud)
和这个
#ifdef _DEBUG
printf("Debug-Message");
#endif
Run Code Online (Sandbox Code Playgroud)
但是这些词都没有定义。每次更改建筑目标时,我是否必须自己定义调试并进行更改,还是有一个我不知道的词?
当我在 CodeBlocks 中使用说明符 F 时,为什么编译器给我错误“格式参数太多”?
#include <stdio.h>
int main()
{
float x = 3.14159;
printf("%f\n", x);
printf("%F\n", x);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
错误:
#include <stdio.h>
int main()
{
float x = 3.14159;
printf("%f\n", x);
printf("%F\n", x);
return 0;
}
Run Code Online (Sandbox Code Playgroud)