使用ncurses在Linux中构建HelloWorld C程序
发布时间:2020-12-13 22:54:17 所属栏目:Linux 来源:网络整理
导读:我成功运行了sudo apt-get install libncurses5-dev 在我的Eclipse窗口中,我尝试构建以下HelloWord.cpp程序: #include ncurses.hint main(){ initscr(); /* Start curses mode */ printw("Hello World !!!"); /* Print Hello World */ refresh(); /* Print
我成功运行了sudo apt-get install libncurses5-dev
在我的Eclipse窗口中,我尝试构建以下HelloWord.cpp程序: #include <ncurses.h> int main() { initscr(); /* Start curses mode */ printw("Hello World !!!"); /* Print Hello World */ refresh(); /* Print it on to the real screen */ getch(); /* Wait for user input */ endwin(); /* End curses mode */ return 0; } 我收到以下错误: Invoking: GCC C++ Linker g++ -m32 -lncurses -L/opt/lib -o "Test_V" ./src/curseTest.o ./src/trajectory.o ./src/xJus-epos.o -lEposCmd /usr/bin/ld: cannot find -lncurses collect2: error: ld returned 1 exit status make: *** [Test_V] Error 1 看起来编译器正在搜索ncurses库而无法找到它?我检查/usr/lib并且那里的库不存在所以我需要手动链接那里的ncurses库 – 我认为get-apt安装程序会自动执行此操作吗? 解决方法g++ HelloWorld.cpp -lncurses -o HelloWolrd 如果你有一台32位机器,gcc编译m32 auto.如果你有一台64位机器,你想要编译32位 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |